mimiqcircuits.decomposition.rules.to_z_rotation¶
Rewrite rule for converting X and Y rotations to Z rotations.
Classes
Rewrite rule that turns |
- class ToZRotationRewrite[source]¶
Bases:
RewriteRuleRewrite rule that turns
GateRXandGateRYintoGateRZand Cliffords.Use it for gate sets whose only parametric rotation is
GateRZ. The rewrite is exact, keeps the angle as it is (symbolic angles included), and listed in circuit order is:GateRX(theta)toH,RZ(theta),H;GateRY(theta)toS†,H,RZ(theta),H,S.
Examples
>>> from mimiqcircuits import * >>> from symengine import pi >>> rule = ToZRotationRewrite() >>> # an X rotation is a Z rotation conjugated by Hadamard gates >>> rule.decompose_step(GateRX(pi/3), [0], [], []) 1-qubit circuit with 3 instructions: ├── H @ q[0] ├── RZ((1/3)*pi) @ q[0] └── H @ q[0]
- decompose_step(op, qubits, bits, zvars)[source]¶
Rewrite an X or Y rotation as a Z rotation between Cliffords.
- Parameters:
- Returns:
A new
Circuitwith the rewrite.- Raises:
DecompositionError – If
opis not aGateRXorGateRY.- Return type: