2323from cirq import linalg
2424from cirq import ops
2525
26- from cirq_ionq .ionq_native_gates import GPIGate , GPI2Gate , MSGate
26+ from cirq_ionq .ionq_native_gates import GPIGate , GPI2Gate , MSGate , ZZGate
2727
2828
2929class IonqNativeGatesetBase (cirq .TwoQubitCompilationTargetGateset ):
@@ -121,13 +121,7 @@ def _hadamard(self, qubit):
121121 return [GPI2Gate (phi = 0.25 ).on (qubit ), GPIGate (phi = 0 ).on (qubit )]
122122
123123 def _cnot (self , * qubits ):
124- return [
125- GPI2Gate (phi = 1 / 4 ).on (qubits [0 ]),
126- MSGate (phi0 = 0 , phi1 = 0 ).on (qubits [0 ], qubits [1 ]),
127- GPI2Gate (phi = 1 / 2 ).on (qubits [1 ]),
128- GPI2Gate (phi = 1 / 2 ).on (qubits [0 ]),
129- GPI2Gate (phi = - 1 / 4 ).on (qubits [0 ]),
130- ]
124+ raise NotImplementedError ()
131125
132126 def decompose_all_to_all_connect_ccz_gate (
133127 self , ccz_gate : 'cirq.CCZPowGate' , qubits : Tuple ['cirq.Qid' , ...]
@@ -199,13 +193,21 @@ def __init__(self, *, atol: float = 1e-8):
199193 def __repr__ (self ) -> str :
200194 return f'cirq_ionq.AriaNativeGateset(atol={ self .atol } )'
201195
196+ def _cnot (self , * qubits ):
197+ return [
198+ GPI2Gate (phi = 1 / 4 ).on (qubits [0 ]),
199+ MSGate (phi0 = 0 , phi1 = 0 ).on (qubits [0 ], qubits [1 ]),
200+ GPI2Gate (phi = 1 / 2 ).on (qubits [1 ]),
201+ GPI2Gate (phi = 1 / 2 ).on (qubits [0 ]),
202+ GPI2Gate (phi = - 1 / 4 ).on (qubits [0 ]),
203+ ]
204+
202205
203206class ForteNativeGateset (IonqNativeGatesetBase ):
204207 """Target IonQ native gateset for compiling circuits.
205208
206209 The gates forming this gateset are:
207- GPIGate, GPI2Gate, MSGate
208- Note: in the future ZZGate might be added here.
210+ GPIGate, GPI2Gate, ZZGate
209211 """
210212
211213 def __init__ (self , * , atol : float = 1e-8 ):
@@ -214,7 +216,21 @@ def __init__(self, *, atol: float = 1e-8):
214216 Args:
215217 atol: A limit on the amount of absolute error introduced by the decomposition.
216218 """
217- super ().__init__ (GPIGate , GPI2Gate , MSGate , ops .MeasurementGate , atol = atol )
219+ super ().__init__ (GPIGate , GPI2Gate , ZZGate , ops .MeasurementGate , atol = atol )
218220
219221 def __repr__ (self ) -> str :
220222 return f'cirq_ionq.ForteNativeGateset(atol={ self .atol } )'
223+
224+ def _cnot (self , * qubits ):
225+ return [
226+ GPI2Gate (phi = 0 ).on (qubits [1 ]),
227+ GPIGate (phi = - 0.125 ).on (qubits [1 ]),
228+ GPI2Gate (phi = 0.5 ).on (qubits [1 ]),
229+ ZZGate (theta = 0.25 ).on (qubits [0 ], qubits [1 ]),
230+ GPI2Gate (phi = 0.75 ).on (qubits [0 ]),
231+ GPIGate (phi = 0.125 ).on (qubits [0 ]),
232+ GPI2Gate (phi = 0.5 ).on (qubits [0 ]),
233+ GPI2Gate (phi = 1.25 ).on (qubits [1 ]),
234+ GPIGate (phi = 0.5 ).on (qubits [1 ]),
235+ GPI2Gate (phi = 0.5 ).on (qubits [1 ]),
236+ ]
0 commit comments