-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile to ZZ gate instead of MS for Forte backends when transpiling to native IonQ gates #6973
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6973 +/- ##
==========================================
- Coverage 98.17% 98.16% -0.01%
==========================================
Files 1085 1085
Lines 94672 94678 +6
==========================================
Hits 92942 92942
- Misses 1730 1736 +6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, after addressing the CI issues. The patch below should do so
Thank you for the PR @radumarg !
diff --git a/cirq-ionq/cirq_ionq/ionq_native_target_gateset.py b/cirq-ionq/cirq_ionq/ionq_native_target_gateset.py
index 9c77d0ef..46679b5d 100644
--- a/cirq-ionq/cirq_ionq/ionq_native_target_gateset.py
+++ b/cirq-ionq/cirq_ionq/ionq_native_target_gateset.py
@@ -120,6 +120,9 @@ class IonqNativeGatesetBase(cirq.TwoQubitCompilationTargetGateset):
def _hadamard(self, qubit):
return [GPI2Gate(phi=0.25).on(qubit), GPIGate(phi=0).on(qubit)]
+ def _cnot(self, *qubits):
+ raise NotImplementedError()
+
def decompose_all_to_all_connect_ccz_gate(
self, ccz_gate: 'cirq.CCZPowGate', qubits: Tuple['cirq.Qid', ...]
) -> 'cirq.OP_TREE':
@@ -199,6 +202,7 @@ class AriaNativeGateset(IonqNativeGatesetBase):
GPI2Gate(phi=-1 / 4).on(qubits[0]),
]
+
class ForteNativeGateset(IonqNativeGatesetBase):
"""Target IonQ native gateset for compiling circuits.
@pavoljuhas CI issues fixed! |
GPI2Gate(phi=1 / 2).on(qubits[0]), | ||
GPI2Gate(phi=-1 / 4).on(qubits[0]), | ||
] | ||
return NotImplemented() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotImplemented
is not callable - it is a constant with special meaning for operator methods (e.g., __eq__
).
The correct thing here is to raise the NotImplementedError
exception (a different thing to the NotImplemented
constant).
Please see details here - https://docs.python.org/3.10/library/constants.html?highlight=notimplemented#NotImplemented
return NotImplemented() | |
raise NotImplementedError() |
@pavoljuhas there were a string of small mistakes, now it should be fine |
Use ZZ gate instead of MS when transpiling circuits to native IonQ gates for forte backends.