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

Add Clifford Tableau decomposition function #4183

Merged
merged 25 commits into from Oct 1, 2021

Conversation

bichengying
Copy link
Collaborator

@bichengying bichengying commented Jun 10, 2021

Decompose clifford tableau into one/two qubits operations (X, Z, S, H, CNOT, and SWAP). The method is based on Aaronson & Gottesman's paper [WIP for #3639].

Issue #4182 is discovered in this PR's test.

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Jun 10, 2021
@bichengying bichengying marked this pull request as ready for review June 10, 2021 05:37
@bichengying bichengying requested review from cduck, vtomole and a team as code owners June 10, 2021 05:37
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
cirq-core/cirq/ops/common_gates.py Outdated Show resolved Hide resolved
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
assert_allclose_up_to_global_phase(cirq.unitary(expect_circ), cirq.unitary(circ), atol=1e-7)


def test_clifford_decompose_by_unitary():
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we can reuse the implementation of assert_implements_consistent_protocols in cirq.testing.consistent_protocols? It does have a decomposition consistent with unitary assertion...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After a brief look of this function, I think it is more suitable to put into the n_qubit_clifford_gate class, which is the next step when all these Clifford Tableau helper functions are done. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that can work - and will be consistent with having Gates having a decomposition - but on the other hand there is nothing wrong with having it on the tableau and then the Gate delegating to the tableau's method, so I think I'm okay to have it here, as this way the Aaaronson-Gottesman paper implementations are kept closer together.

cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
bichengying and others added 6 commits June 15, 2021 21:47
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
@bichengying bichengying requested a review from balopat June 16, 2021 05:06
@balopat balopat self-assigned this Jul 1, 2021
@google-cla
Copy link

google-cla bot commented Sep 29, 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 29, 2021
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

LGTM. @Strilanc for visibility.

cirq-core/cirq/optimizers/clifford_decomposition.py Outdated Show resolved Hide resolved
@google-cla
Copy link

google-cla bot commented Oct 1, 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 Oct 1, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Oct 1, 2021
@google-cla
Copy link

google-cla bot commented Oct 1, 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 Oct 1, 2021
@CirqBot
Copy link
Collaborator

CirqBot commented Oct 1, 2021

Automerge cancelled: A status check is failing.

@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 Oct 1, 2021
@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 Oct 1, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Oct 1, 2021
@CirqBot CirqBot merged commit 9d0ac9c into quantumlib:master Oct 1, 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 Oct 1, 2021
CirqBot pushed a commit that referenced this pull request Feb 22, 2022
Add initial Clifford Gate with multiple qubits. Compared with SingleQubitCliffordGate, it has fewer functionalities since we cannot enumerate all of them with PauliGates and several special single qubit properties like Bloch rotation no longer exist. Anyway, it provides several basic interactions:
1. It uses Clifford tableau as underlying data representation (different from the state representation).
2. It can be constructed from a tableau or list of operations (`_has_stabilizer_effect_` only). All Clifford gates can be built through \{S, H, CNOT\}, so we can construct any Clifford Gate from the list of operations. We just cannot pre-define it.
3. Decomposing into several basic operations.
4. Get unitary matrix through decomposing (we cannot do this in a reverse way from unitary to Clifford gate :( ).
5. Know how to interact with ActOnCliffordTableauArgs, i.e. it should be able to use with CliffordTableau simulator (Looks like we don't have that in cirq yet?  @daxfohl will add that? see #4639 and #4748.).

This PR is part of efforts for #3639. Context: this PR doesn't introduce any new algorithms but the key methods are already implemented in #4183 and #4096.
95-martin-orion pushed a commit to 95-martin-orion/Cirq that referenced this pull request Mar 2, 2022
Add initial Clifford Gate with multiple qubits. Compared with SingleQubitCliffordGate, it has fewer functionalities since we cannot enumerate all of them with PauliGates and several special single qubit properties like Bloch rotation no longer exist. Anyway, it provides several basic interactions:
1. It uses Clifford tableau as underlying data representation (different from the state representation).
2. It can be constructed from a tableau or list of operations (`_has_stabilizer_effect_` only). All Clifford gates can be built through \{S, H, CNOT\}, so we can construct any Clifford Gate from the list of operations. We just cannot pre-define it.
3. Decomposing into several basic operations.
4. Get unitary matrix through decomposing (we cannot do this in a reverse way from unitary to Clifford gate :( ).
5. Know how to interact with ActOnCliffordTableauArgs, i.e. it should be able to use with CliffordTableau simulator (Looks like we don't have that in cirq yet?  @daxfohl will add that? see quantumlib#4639 and quantumlib#4748.).

This PR is part of efforts for quantumlib#3639. Context: this PR doesn't introduce any new algorithms but the key methods are already implemented in quantumlib#4183 and quantumlib#4096.
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Decompose clifford tableau  into one/two qubits operations (X, Z, S, H, CNOT, and SWAP). The method is based on [Aaronson & Gottesman's paper](https://arxiv.org/abs/quant-ph/0406196) [WIP for quantumlib#3639].

Issue quantumlib#4182 is discovered in this PR's test.
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Add initial Clifford Gate with multiple qubits. Compared with SingleQubitCliffordGate, it has fewer functionalities since we cannot enumerate all of them with PauliGates and several special single qubit properties like Bloch rotation no longer exist. Anyway, it provides several basic interactions:
1. It uses Clifford tableau as underlying data representation (different from the state representation).
2. It can be constructed from a tableau or list of operations (`_has_stabilizer_effect_` only). All Clifford gates can be built through \{S, H, CNOT\}, so we can construct any Clifford Gate from the list of operations. We just cannot pre-define it.
3. Decomposing into several basic operations.
4. Get unitary matrix through decomposing (we cannot do this in a reverse way from unitary to Clifford gate :( ).
5. Know how to interact with ActOnCliffordTableauArgs, i.e. it should be able to use with CliffordTableau simulator (Looks like we don't have that in cirq yet?  @daxfohl will add that? see quantumlib#4639 and quantumlib#4748.).

This PR is part of efforts for quantumlib#3639. Context: this PR doesn't introduce any new algorithms but the key methods are already implemented in quantumlib#4183 and quantumlib#4096.
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: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants