Recover the decomposition of a single-qubit matrix \(U\) in terms of elementary operations.
Diagonal operations can be converted to a single
RZgate, while non-diagonal operations will be converted to a
Rotgate 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
Rotgates, including those that are diagonal.
Rotgate on the specified wire that implements
Uup to a global phase, or an equivalent
- 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
Rotgate that implements the same operation, up to a global phase:
>>> decomp = zyz_decomposition(U, 0) >>> decomp [Rot(-0.24209529417800013, 1.14938178234275, 1.7330581433950871, wires=)]
- What is PennyLane?
- Quantum circuits
- Gradients and training
- Quantum operators
- Inspecting circuits
- Compiling circuits
- Quantum Chemistry
- Quantum Datasets
- QNode returns