mimiqcircuits.decomposition.rules.zyz

ZYZ Euler angle decomposition rewrite rule.

Classes

ZYZRewrite()

Rewrite rule for ZYZ Euler angle decomposition.

class mimiqcircuits.decomposition.rules.zyz.ZYZRewrite[source]

Bases: RewriteRule

Rewrite rule for ZYZ Euler angle decomposition.

Decomposes single-qubit unitaries into the ZYZ Euler angle form: RZ(phi) * RY(theta) * RZ(lambda)

This is a standard decomposition for arbitrary single-qubit gates, producing only Z and Y rotations (plus a global phase for GateU).

Supported operations:
  • GateU(theta, phi, lambda, gamma) -> RZ(lambda) * RY(theta) * RZ(phi) * Phase(gamma)

  • GateRX(theta) -> S * RY(theta) * Sdg

Identity rotations (angle = 0) are omitted from the output.

Example

>>> from mimiqcircuits import GateU
>>> from mimiqcircuits.decomposition import ZYZRewrite
>>> from symengine import pi
>>> rule = ZYZRewrite()
>>> circ = rule.decompose_step(GateU(pi/2, pi/4, pi/3), [0], [], [])
matches(op)[source]

Check if this rule can decompose the operation.

Matches GateU (unless it’s identity) and GateRX.

Parameters:

op (Operation) – The operation to check.

Returns:

True if this rule can decompose the operation.

Return type:

bool

decompose_step(op, qubits, bits, zvars)[source]

Apply ZYZ decomposition to the operation.

Parameters:
  • op (Operation) – The operation to decompose (GateU or GateRX).

  • qubits (Sequence[int]) – Qubit indices for the operation.

  • bits (Sequence[int]) – Classical bit indices (unused).

  • zvars (Sequence[int]) – Z-variable indices (unused).

Returns:

A Circuit containing the decomposed instructions.

Raises:

DecompositionError – If the operation is not supported.

Return type:

Circuit