Skip to content

Commit 0fe14bb

Browse files
authored
Add default decompositions for XXPowGate and YYPowGate which terminate in CZPowGate. (quantumlib#4862)
Part of quantumlib#4858 Decompositions are tested as part of `assert_eigengate_implements_consistent_protocols`, which is already tested for both gates.
1 parent 742a280 commit 0fe14bb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cirq/ops/parity_gates.py

+10
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ def _decompose_into_clifford_with_qubits_(self, qubits):
104104
]
105105
return NotImplemented
106106

107+
def _decompose_(self, qubits: Tuple['cirq.Qid', ...]) -> 'cirq.OP_TREE':
108+
yield common_gates.YPowGate(exponent=-0.5).on_each(*qubits)
109+
yield ZZPowGate(exponent=self.exponent, global_shift=self.global_shift)(*qubits)
110+
yield common_gates.YPowGate(exponent=0.5).on_each(*qubits)
111+
107112
def _circuit_diagram_info_(
108113
self, args: 'cirq.CircuitDiagramInfoArgs'
109114
) -> Union[str, 'protocols.CircuitDiagramInfo']:
@@ -216,6 +221,11 @@ def _decompose_into_clifford_with_qubits_(self, qubits):
216221
]
217222
return NotImplemented
218223

224+
def _decompose_(self, qubits: Tuple['cirq.Qid', ...]) -> 'cirq.OP_TREE':
225+
yield common_gates.XPowGate(exponent=0.5).on_each(*qubits)
226+
yield ZZPowGate(exponent=self.exponent, global_shift=self.global_shift)(*qubits)
227+
yield common_gates.XPowGate(exponent=-0.5).on_each(*qubits)
228+
219229
def _circuit_diagram_info_(
220230
self, args: 'cirq.CircuitDiagramInfoArgs'
221231
) -> 'cirq.CircuitDiagramInfo':

0 commit comments

Comments
 (0)