-
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 StabilizerTable
class
#3931
Add StabilizerTable
class
#3931
Conversation
b2edf7b
to
4897fb9
Compare
3c986a6
to
9832b02
Compare
* Symplectic representation of a list of N-qubit Pauli's with +1 or -1 phases
9832b02
to
0c39df0
Compare
|
||
|
||
class StabilizerTable(PauliTable): | ||
r"""Symplectic representation of a list Stabilizer matrices. |
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.
typo
\end{array}\right) | ||
|
||
where each row is a block vector :math:`[X_i, Z_i]` with | ||
:math:`X = [x_{i,0}, ..., x_{i,N-1}]`, :math:`Z = [z_{i,0}, ..., z_{i,N-1}]` |
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.
"x_i = [x_{i,0},...]"?
""" | ||
|
||
def __init__(self, data, phase=None): | ||
"""Initialize the PauliTable. |
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.
StabilizerTable
|
||
def __getitem__(self, key): | ||
"""Return a view of StabilizerTable""" | ||
if isinstance(key, (int, np.int)): |
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.
isinstance(np.int(2), int)
returns True so not sure these need to be distinguished.
Pauli rows (Default: False). | ||
|
||
Returns: | ||
PauliTable: the resulting table with the entries inserted. |
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.
StabilizerTable
sort_inds = index.argsort() | ||
index = index[sort_inds] | ||
unique = self[index] | ||
# Concatinate return tuples |
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.
spelling
if not isinstance(other, StabilizerTable): | ||
other = StabilizerTable(other) | ||
if qargs is None and other.num_qubits != self.num_qubits: | ||
raise QiskitError("other PauliTable must be on the same number of qubits.") |
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.
Would it be better to reference StabilizerTable here?
r"""Convert to a list or array of Stabilizer matrices. | ||
|
||
For large StabilizerTables converting using the ``array=True`` | ||
kwarg will be more efficient since it allocates memory a full |
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.
..for a...
with self.subTest(msg='str init "I"'): | ||
value = StabilizerTable('I')._array | ||
target = np.array([[False, False]], dtype=np.bool) | ||
self.assertTrue(np.all(np.array(value == target))) |
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 test is already covered above.
* Add StabilizerTable class * Symplectic representation of a list of N-qubit Pauli's with +1 or -1 phases * Add stabilizer table tests * Add release note * Fix _add and _multiply methods * Linting * Update qubit ordering and tests * Doc warning fix * Rename n_qubits to num_qubits * Add qargs add to StabilizerTable * Fix links in release note * Update for review comments Co-authored-by: ewinston <ewinston@us.ibm.com>
Summary
PauliTable
symplectic operator class #3889 (on-hold until merged)Adds a
StabilizerTable
subclass ofPauliTable
that is an efficient representation of a list of N-qubit stabilizers (real Pauli matrices with +1 or -1 coefficients). This class is implemented by adding a boolean phase vector the Pauli table symplectic array.This class will be used as a basis for a Clifford operator class.
Details and comments