zyz_decomposition(U, wire)[source]

Recover the decomposition of a single-qubit matrix \(U\) in terms of elementary operations.

Diagonal operations can be converted to a single RZ gate, while non-diagonal operations will be converted to a Rot gate that implements the original operation up to a global phase in the form \(RZ(\omega) RY(\theta) RZ(\phi)\).


When used with jax.jit, all unitaries will be converted to Rot gates, including those that are diagonal.

  • U (tensor) – A 2 x 2 unitary matrix.

  • wire (Union[Wires, Sequence[int] or int]) – The wire on which to apply the operation.


A Rot gate on the specified wire that implements U up to a global phase, or an equivalent RZ gate if U is diagonal.

Return type



Suppose we would like to apply the following unitary operation:

U = np.array([
    [-0.28829348-0.78829734j,  0.30364367+0.45085995j],
    [ 0.53396245-0.10177564j,  0.76279558-0.35024096j]

For PennyLane devices that cannot natively implement QubitUnitary, we can instead recover a Rot gate that implements the same operation, up to a global phase:

>>> decomp = zyz_decomposition(U, 0)
>>> decomp
[Rot(-0.24209529417800013, 1.14938178234275, 1.7330581433950871, wires=[0])]