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

Multiple Qubits Clifford Gate #4791

Merged
merged 38 commits into from
Feb 22, 2022
Merged

Conversation

BichengYing
Copy link
Collaborator

@BichengYing BichengYing commented Jan 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 Clifford-specific protocols #4639 and Fix act-on specialization for all the Clifford simulators #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.

@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jan 2, 2022
@BichengYing BichengYing marked this pull request as ready for review January 5, 2022 03:26
@BichengYing BichengYing requested review from cduck, vtomole and a team as code owners January 5, 2022 03:26
@BichengYing
Copy link
Collaborator Author

@MichaelBroughton Thanks for the reviewing! I think I have addressed most comments but also left a few more to discuss. PTAL.

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, be sure to tag me on the next PR the combines these two gates into an inheritance hierarchy :).

@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Feb 22, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Feb 22, 2022
@CirqBot CirqBot merged commit 1bbbc9f into quantumlib:master Feb 22, 2022
@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 Feb 22, 2022
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.
CirqBot pushed a commit that referenced this pull request Apr 20, 2022
This PR mainly moved the `SingleQubitCliffordGate` as the derived class of `CliffordGate`.

It didn't add any new functionalities or features. The code change looks large but actually not. Because I moved the
`SingleQubitCliffordGate` to the place after `CliffordGate` and auto-diff is not that smart enough to tell that. Context #4791.

 Main change are:
1. Modify the value equality so that SingleQubitCliffordGate can be evaluate equal to the same CliffordGate
2. Moved the module-level initialization common SingleQubitCliffordGate (like X, Y, Z) to the class-level one.
3. Make a few function `SingleQubitCliffordGate` to use `CliffordGate` one.
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Apr 22, 2022
This PR mainly moved the `SingleQubitCliffordGate` as the derived class of `CliffordGate`.

It didn't add any new functionalities or features. The code change looks large but actually not. Because I moved the
`SingleQubitCliffordGate` to the place after `CliffordGate` and auto-diff is not that smart enough to tell that. Context quantumlib#4791.

 Main change are:
1. Modify the value equality so that SingleQubitCliffordGate can be evaluate equal to the same CliffordGate
2. Moved the module-level initialization common SingleQubitCliffordGate (like X, Y, Z) to the class-level one.
3. Make a few function `SingleQubitCliffordGate` to use `CliffordGate` one.
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.
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
This PR mainly moved the `SingleQubitCliffordGate` as the derived class of `CliffordGate`.

It didn't add any new functionalities or features. The code change looks large but actually not. Because I moved the
`SingleQubitCliffordGate` to the place after `CliffordGate` and auto-diff is not that smart enough to tell that. Context quantumlib#4791.

 Main change are:
1. Modify the value equality so that SingleQubitCliffordGate can be evaluate equal to the same CliffordGate
2. Moved the module-level initialization common SingleQubitCliffordGate (like X, Y, Z) to the class-level one.
3. Make a few function `SingleQubitCliffordGate` to use `CliffordGate` one.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
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.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
This PR mainly moved the `SingleQubitCliffordGate` as the derived class of `CliffordGate`.

It didn't add any new functionalities or features. The code change looks large but actually not. Because I moved the
`SingleQubitCliffordGate` to the place after `CliffordGate` and auto-diff is not that smart enough to tell that. Context quantumlib#4791.

 Main change are:
1. Modify the value equality so that SingleQubitCliffordGate can be evaluate equal to the same CliffordGate
2. Moved the module-level initialization common SingleQubitCliffordGate (like X, Y, Z) to the class-level one.
3. Make a few function `SingleQubitCliffordGate` to use `CliffordGate` one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants