mimiqcircuits.decomposition.rules.zyz¶
ZYZ Euler angle decomposition rewrite rule.
Classes
Rewrite rule for the ZYZ Euler decomposition of single-qubit gates. |
- class ZYZRewrite[source]¶
Bases:
RewriteRuleRewrite rule for the ZYZ Euler decomposition of single-qubit gates.
Writes a single-qubit gate as Z and Y rotations, the Euler form \(R_Z(\phi) R_Y(\theta) R_Z(\lambda)\).
Supported Operations
GateU(theta, phi, lambda, gamma), except the identity (all oftheta,phiandlambdazero), toRZ(lambda),RY(theta),RZ(phi)in circuit order, followed byGateU(0, 0, 0, gamma)for the phasegamma. Rotations by a zero angle are left out. The result equals the gate up to a global phase.GateRX(theta)toS,RY(theta),S†in circuit order, which is exact.
Examples
>>> from mimiqcircuits import * >>> from symengine import pi >>> rule = ZYZRewrite() >>> # the Euler angles of GateU become Z and Y rotations >>> rule.decompose_step(GateU(pi/2, pi/4, pi/3), [0], [], []) 1-qubit circuit with 3 instructions: ├── RZ((1/3)*pi) @ q[0] ├── RY((1/2)*pi) @ q[0] └── RZ((1/4)*pi) @ q[0]
- matches(op)[source]¶
Check whether an operation is a
GateUorGateRX.A
GateUwhosetheta,phiandlambdaare all zero is not matched, since it is only a phase.
- decompose_step(op, qubits, bits, zvars)[source]¶
Rewrite a
GateUorGateRXas Z and Y rotations.- Parameters:
- Returns:
A new
Circuitwith the rewrite.- Raises:
DecompositionError – If
matches()rejectsop.- Return type: