-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
operator class
#3938
Conversation
8dbdad2
to
561c933
Compare
# Clifford array. | ||
|
||
# Condition is | ||
# table.T * [[0, 1], [1, 0]] * table = [[0, 1], [1, 0]] |
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.
this actually checks that the clifford table is a symplectic matrix, so perhaps this method should be called 'is_symplectic' or 'is_clifford' (and not 'is_unitary')?
501c0e7
to
98fd14e
Compare
e735b03
to
d7ced8b
Compare
Clifford
operator classClifford
operator class
Co-Authored-By: Christopher J. Wood <cjwood@us.ibm.com>
* Added `to_circuit` method * Added `to_gate` method * Added `to_matrix` method * Added `to_operator`
test_clifford_gates -> test_clifford clifford_append_gate -> clifford_circuits Fix n_qubits -> num_qubits Fix tensor order bug Fix append 2-qubit gate tests Speed up compose Fix qubit order issue with subsystem compose Add check that table is valid on clifford __init__
d7ced8b
to
4e2390e
Compare
There are a few basic methods that were not tested: |
@ShellyGarion I've added some tests for the methods you mentioned |
return self.to_circuit().to_gate() | ||
|
||
@staticmethod | ||
def from_instruction(instruction): |
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'd call this from_circuit
to be consistent with (future!) plans to unify things under the banner of circuits.
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.
also there are probably other instances of this function in other parts of quantum_info. they should all just talk about converting to/from that object and circuits. One side is simulation and the other is synthesis.
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.
Most of the operators / states have a from instruction that I could change to from_circuit. Will have to add deprecation warnings to from_instruction for Statevector
and DensityMatrix
. It might be easier to change them all in a single PR after this is merged.
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.
thanks for addressing the comments, looks good
* Add Clifford operator class * Add compose, tensor, expand, and is_unitary Co-Authored-By: Christopher J. Wood <cjwood@us.ibm.com> * Add tests * 1 and two qubit clifford gates * compose, dot, tensor, expand, conjugate, transopse, is_unitary, to_operator Co-Authored-By: Christopher J. Wood <cjwood@us.ibm.com> Co-Authored-By: Shelly Garion <shellygarion@users.noreply.github.com> * Add clifford conversion methods based on circuit decomposition * Added `to_circuit` method * Added `to_gate` method * Added `to_matrix` method * Added `to_operator` * Rename files and fix bugs test_clifford_gates -> test_clifford clifford_append_gate -> clifford_circuits Fix n_qubits -> num_qubits Fix tensor order bug Fix append 2-qubit gate tests Speed up compose Fix qubit order issue with subsystem compose Add check that table is valid on clifford __init__ * Add adjoint and conjugate * add tests for compose and dot of subsystems, and for to_circuit * Add Clifford class docs and reno * Linting and doc fox * Review comments * Add tests for to_matrix, to_instruction * Add to_dict/from_dict tests * Add underscore to private clifford funcs * Rename `append_gate` to `_append_circuit` * Rename from_instruction to from_circuit * lint * move decompose_clifford to synethsis Co-authored-by: sethmerkel <49210444+sethmerkel@users.noreply.github.com> Co-authored-by: Shelly Garion <46566946+ShellyGarion@users.noreply.github.com> Co-authored-by: Shelly Garion <shellygarion@users.noreply.github.com>
Summary
StabilizerTable
class #3931 (on-hold until it is merged)Start of a Clifford operator class based on the
StabilizerTable
class for its internal data structure.Adds
clifford_utils
file that contains helper functions for directly updating a Clifford object with standard 1 and 2 qubit Clifford basis gates.TODO
Implement the methods of the BaseOperator API directly as vectorized table update methods on the StabilizerTable and add unit tests.
compose
tensor / expand
conjugate
transpose
is_unitary
to_matrix
to_operator