Qubit Rotations (quanguru.QuantumToolbox.spinRotations)#

Contains functions to create qubit rotation operators.

Functions#

qubRotation(xyz, angle[, sparse])

Creates the operator R_{i}(\theta) := e^{-i\sigma_{i}\theta/2} for qubit rotation around the i = x/y/z-axis by angle \theta.

spinRotation(xyz, angle, j[, sparse, isDim])

Creates the operator R_{i}(\theta) := e^{-iJ_{i}\theta} for a spin value j rotation around i = x/y/z-axis by angle \theta.

xRotation(angle[, sparse])

Creates the operator R_{x}(\theta) for qubit rotation around the x-axis by angle \theta.

yRotation(angle[, sparse])

Creates the operator R_{y}(\theta) for qubit rotation around the y-axis by angle \theta.

zRotation(angle[, sparse])

Creates the operator R_{z}(\theta) for qubit rotation around the z-axis by angle \theta.

Function Name

Docstrings

Examples

Unit Tests

Tutorials

qubRotation

      ✅

    ❌

    ❌

    ❌

spinRotation

      ✅

    ❌

    ❌

    ❌

xRotation

      ✅

    ❌

    ❌

    ❌

yRotation

      ✅

    ❌

    ❌

    ❌

zRotation

      ✅

    ❌

    ❌

    ❌

xRotation(angle: float, sparse: bool = True) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates the operator R_{x}(\theta) for qubit rotation around the x-axis by angle \theta.

Parameters
  • angle (float) – angle of rotation around x

  • sparse (bool) – if True(False), the returned Matrix type will be sparse(array)

Returns

Qubit X rotation operator R_{x}(\theta)

Return type

Matrix

Examples

# TODO

yRotation(angle: float, sparse: bool = True) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates the operator R_{y}(\theta) for qubit rotation around the y-axis by angle \theta.

Parameters
  • angle (float) – angle of rotation around y

  • sparse (bool) – if True(False), the returned Matrix type will be sparse(array)

Returns

Qubit Y rotation operator R_{y}(\theta)

Return type

Matrix

Examples

# TODO

zRotation(angle: float, sparse: bool = True) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates the operator R_{z}(\theta) for qubit rotation around the z-axis by angle \theta.

Parameters
  • angle (float) – angle of rotation around z

  • sparse (bool) – if True(False), the returned Matrix type will be sparse(array)

Returns

Qubit Z rotation operator R_{z}(\theta)

Return type

Matrix

Examples

# TODO

qubRotation(xyz: str, angle: float, sparse: bool = True) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates the operator R_{i}(\theta) := e^{-i\sigma_{i}\theta/2} for qubit rotation around the i = x/y/z-axis by angle \theta.

Parameters
  • xyz (str) – string for rotation direction x, y, or z

  • angle (float) – angle of rotation

  • sparse (bool) – if True(False), the returned Matrix type will be sparse(array)

Returns

Qubit x/y/z rotation operator.

Return type

Matrix

Examples

# TODO

spinRotation(xyz: str, angle: float, j: float, sparse: bool = True, isDim: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates the operator R_{i}(\theta) := e^{-iJ_{i}\theta} for a spin value j rotation around i = x/y/z-axis by angle \theta.

Parameters
  • xyz (str) – string for rotation direction x, y, or z

  • angle (float) – angle of rotation

  • j (int or float) – integer or half-integer spin quantum number, or the dimension (then spin quantum number = (d-1)/2)

  • sparse (bool) – if True(False), the returned Matrix type will be sparse(array)

  • isDim (bool) – boolean for whether j is spin quantum number of dimension

Returns

Spin x/y/z rotation operator.

Return type

Matrix

Examples

# TODO