Skip to content
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

Replace the underlying representation of SingleCliffordGate by CliffordTableau #4165

Merged
merged 36 commits into from
Sep 28, 2021

Conversation

BichengYing
Copy link
Collaborator

The current implementation of SingleQubitCliffordGate is based on rotation_map and inverse_rotation_map. It is concise for SingleQubitCliffordGate but hard to extend into any number of qubits clifford gates. For generalization, this PR replaces them by the CliffordTableau. All functionalities and interfaces of SingleCliffordGate should be the same after the replacement. [WIP for #3639].

I didn't deprecate PauliTransform (#4088) in this PR for minimize the PR's responsibility. But after this PR, it will be easy to do it.

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Jun 5, 2021
@BichengYing BichengYing marked this pull request as ready for review June 6, 2021 01:31
@BichengYing BichengYing requested review from cduck, vtomole and a team as code owners June 6, 2021 01:31
@BichengYing BichengYing requested a review from dstrain115 June 6, 2021 01:31
@balopat balopat requested review from balopat and removed request for dstrain115 June 7, 2021 18:16
Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, with nits. Do we have any idea how much slower this representation will be compared to the current mapping?

@BichengYing
Copy link
Collaborator Author

Looking good, with nits. Do we have any idea how much slower this representation will be compared to the current mapping?

Thanks for reviewing. This is just single qubit clifford gate. One more or two more dictionary lookups probably are negligible.
Plus, those extract lookup should only happen once to construct the gate. The repeated steps involve the methods like either _unitary_ or _decompose_ is untouched. This class has no _act_on_ yet. But having tableau won't slow down it.

@95-martin-orion 95-martin-orion requested a review from balopat July 1, 2021 13:39
@95-martin-orion
Copy link
Collaborator

Pinging @balopat for re-review.

@google-cla
Copy link

google-cla bot commented Sep 27, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Sep 27, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@BichengYing
Copy link
Collaborator Author

@ybc1991 it looks like in the time this PR has spent open, it has slipped on a few of the integration tests. Would you mind fixing those up and then we can merge this in ASAP ?

Yes, I have updated the file. I think the error was because of the serialization, which was based on the old rotation and inverse map, which won't exist as the class members after this PR. PTAL again.

@MichaelBroughton
Copy link
Collaborator

This looks good. Can you try commenting the @googlebot I fixed it to see if that can flip the switch on this CLA check ?

@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@BichengYing
Copy link
Collaborator Author

@googlebot I fixed it.

@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@MichaelBroughton MichaelBroughton added cla: yes Makes googlebot stop complaining. and removed cla: no labels Sep 28, 2021
@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes Makes googlebot stop complaining. labels Sep 28, 2021
@BichengYing
Copy link
Collaborator Author

@googlebot I fixed it.

@google-cla
Copy link

google-cla bot commented Sep 28, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@MichaelBroughton MichaelBroughton added cla: yes Makes googlebot stop complaining. automerge Tells CirqBot to sync and merge this PR. (If it's running.) and removed cla: no labels Sep 28, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Sep 28, 2021
@CirqBot CirqBot merged commit 34d0f8b into quantumlib:master Sep 28, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Sep 28, 2021
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…rdTableau (quantumlib#4165)

The current implementation of SingleQubitCliffordGate is based on `rotation_map` and `inverse_rotation_map`. It is concise for SingleQubitCliffordGate but hard to extend into any number of qubits clifford gates. For generalization, this PR replaces them by the `CliffordTableau`.  All functionalities and interfaces of SingleCliffordGate should be the same after the replacement. [WIP for quantumlib#3639].

I didn't deprecate PauliTransform (quantumlib#4088) in this PR for minimize the PR's responsibility. But after this PR, it will be easy to do it.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
…rdTableau (quantumlib#4165)

The current implementation of SingleQubitCliffordGate is based on `rotation_map` and `inverse_rotation_map`. It is concise for SingleQubitCliffordGate but hard to extend into any number of qubits clifford gates. For generalization, this PR replaces them by the `CliffordTableau`.  All functionalities and interfaces of SingleCliffordGate should be the same after the replacement. [WIP for quantumlib#3639].

I didn't deprecate PauliTransform (quantumlib#4088) in this PR for minimize the PR's responsibility. But after this PR, it will be easy to do it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining. size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants