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
Serialize SingleQubitCliffordGate #4421
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
@MichaelBroughton I am very sorry about the force pushes. My branch was showing a random error and incompatibility with the master |
@@ -436,6 +436,18 @@ def __repr__(self) -> str: | |||
f'Y:{y_sign}{y.to!s}, Z:{z_sign}{z.to!s})' | |||
) | |||
|
|||
@classmethod | |||
def _from_json_dict_(cls, _rotation_map, _inverse_map, **kwargs): |
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.
I wonder if it would be worth having a (parameterized) test in clifford_gate_test.py to run through all the single qubit clifford gates and do the round trip to json and from json and make sure they are equal. This might be a little bit higher confidence than having the single example in json_test_data, especially since that example has an empty inverse map.
Otherwise seems good to me.
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.
Can you please check now?
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.
@dstrain115 ping!
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@MichaelBroughton can you please check if this is okay? |
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
Closes quantumlib#3980 I tried to mimic the `PauliString` Class for serialization - https://github.com/quantumlib/Cirq/blob/4aeb719c2ff9f2394a564237886fb573c830ecad/cirq-core/cirq/ops/pauli_string.py#L175-L185
Closes #3980
I tried to mimic the
PauliString
Class for serialization -Cirq/cirq-core/cirq/ops/pauli_string.py
Lines 175 to 185 in 4aeb719