qp.single_qubit_zyz_angles

single_qubit_zyz_angles(op)[source]

Returns the equivalent ZYZ rotation angles of a single-qubit operator.

A single-qubit unitary operator is equivalent to a product of Z and Y rotations in the form \(e^{i\alpha} RZ(\omega) RY(\theta) RZ(\phi)\).

Parameters:

op (Operator) – the operator to obtain rotation angles for.

Returns:

A tuple of (\(\phi\), \(\theta\), \(\omega\), \(\alpha\)) where the first three values are the rotation angles and \(\alpha\) is the global phase.

Examples

>>> qp.single_qubit_zyz_angles(qp.H(0))
(3.141..., 1.570..., 0.0, 1.570...)

We can verify that this is correct:

phi, theta, omega, alpha = qp.single_qubit_zyz_angles(qp.H(0))

def circuit():
    qp.RZ(phi, wires=0)
    qp.RY(theta, wires=0)
    qp.RZ(omega, wires=0)
    qp.GlobalPhase(-alpha)  # note the negative sign convention
>>> qp.math.allclose(qp.matrix(circuit, wire_order=[0])(), qp.H(0).matrix())
True

Contents

Using PennyLane

Release news

Development

API

Internals