Euler

graphqomb.euler module

Euler angles and related functions.

This module provides:

Local Operators

class graphqomb.euler.LocalUnitary[source]

Bases: object

Class to represent signle-qubit unitaries.

\(U(\alpha, \beta, \gamma) = R_z(\gamma)R_x(\beta)R_z(\alpha)\)

alpha

angle for the first \(R_z\), by default 0

Type:

float

beta

angle for the \(R_x\), by default 0

Type:

float

gamma

angle for the last \(R_z\), by default 0

Type:

float

__init__(alpha=0, beta=0, gamma=0)[source]
print_angles()[source]

Print the Euler angles.

conjugate()[source]

Return the conjugate of the LocalUnitary object.

Returns:

conjugate LocalUnitary

Return type:

LocalUnitary

matrix()[source]

Return the 2x2 unitary matrix corresponding to the Euler angles.

Returns:

2x2 unitary matrix

Return type:

numpy.typing.NDArray[numpy.complex128]

class graphqomb.euler.LocalClifford[source]

Bases: LocalUnitary

Class to represent a local Clifford.

\(U(\alpha, \beta, \gamma) = R_z(\gamma)R_x(\beta)R_z(\alpha)\) Each angle must be integer multiples of \(\pi/2\).

alpha

angle for the first \(R_z\). The angle must be a multiple of \(\pi/2\), by default 0

Type:

float

beta

angle for the \(R_x\). The angle must be a multiple of \(\pi/2\), by default 0

Type:

float

gamma

angle for the last \(R_z\). The angle must be a multiple of \(\pi/2\), by default 0

Type:

float

__init__(alpha=0, beta=0, gamma=0)[source]
conjugate()[source]

Return the conjugate of the LocalClifford object.

Returns:

conjugate LocalClifford

Return type:

LocalClifford

Functions

graphqomb.euler.euler_decomposition(u)[source]

Decompose a 2x2 unitary matrix into Euler angles.

\(U \rightarrow R_z(\gamma)R_x(\beta)R_z(\alpha)\)

Parameters:

u (numpy.typing.NDArray[numpy.complex128]) – unitary 2x2 matrix

Returns:

euler angles (\(\alpha\), \(\beta\), \(\gamma\))

Return type:

tuple[float, float, float]

graphqomb.euler.bloch_sphere_coordinates(vector)[source]

Get the Bloch sphere coordinates corresponding to a vector.

\(|\psi\rangle = \cos(\theta/2)|0\rangle + \exp(i\phi)\sin(\theta/2)|1\rangle\)

Parameters:

vector (numpy.typing.NDArray[numpy.complex128]) – 1 qubit state vector

Returns:

Bloch sphere coordinates (\(\theta\), \(\phi\))

Return type:

tuple[float, float]

graphqomb.euler.meas_basis_info(vector)[source]

Return the measurement plane and angle corresponding to a vector.

Parameters:

vector (numpy.typing.NDArray[numpy.complex128]) – 1 qubit state vector

Returns:

measurement plane and angle

Return type:

tuple[Plane, float]

Raises:

ValueError – if the vector does not lie on any of 3 planes

graphqomb.euler.update_lc_lc(lc1, lc2)[source]

Update a LocalClifford object with another LocalClifford object.

Parameters:
Returns:

multiplied LocalClifford

Return type:

LocalClifford

graphqomb.euler.update_lc_basis(lc, basis)[source]

Update a MeasBasis object with an action of LocalClifford object.

Parameters:
Returns:

updated PlannerMeasBasis

Return type:

PlannerMeasBasis