-
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
Support inverse gate JSON seralization #6912
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6912 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 1084 1084
Lines 94290 94293 +3
=======================================
+ Hits 92280 92283 +3
Misses 2010 2010 ☔ View full report in Codecov by Sentry. |
@@ -281,4 +281,5 @@ def _symmetricalqidpair(qids): | |||
'sympy.EulerGamma': lambda: sympy.EulerGamma, | |||
'complex': complex, | |||
'datetime.datetime': _datetime, | |||
'_InverseCompositeGate': cirq.inverse, |
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.
Is there a reason this is calling cirq.inverse vs instantiating the _InverseCompositeGate class? I am not sure which is better.
I guess if we created an inverse for a gate in a newer version of cirq, it could instantiate that instead, which would not be consistent object-wise, but might be a better result? For instance, we could fix this so QubitPermutationGate(0,1,2) ^ -1 returns QubitPermutationGate(2,1,0) or whatever.
In any case, maybe add a comment to explain the behaviour.
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 pending one comment.
Response to issue #6769
Fix validation
Running the code snippet provided in #6769 now yields correct result: