Add StabilizerTable class#3931
Merged
mergify[bot] merged 13 commits intoMar 26, 2020
Merged
Conversation
b2edf7b to
4897fb9
Compare
10 tasks
3c986a6 to
9832b02
Compare
* Symplectic representation of a list of N-qubit Pauli's with +1 or -1 phases
9832b02 to
0c39df0
Compare
ewinston
reviewed
Mar 23, 2020
|
|
||
|
|
||
| class StabilizerTable(PauliTable): | ||
| r"""Symplectic representation of a list Stabilizer matrices. |
| \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}]` |
| """ | ||
|
|
||
| def __init__(self, data, phase=None): | ||
| """Initialize the PauliTable. |
|
|
||
| def __getitem__(self, key): | ||
| """Return a view of StabilizerTable""" | ||
| if isinstance(key, (int, np.int)): |
Contributor
There was a problem hiding this comment.
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. |
| sort_inds = index.argsort() | ||
| index = index[sort_inds] | ||
| unique = self[index] | ||
| # Concatinate return tuples |
| 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.") |
Contributor
There was a problem hiding this comment.
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 |
Comment on lines
+109
to
+112
| 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))) |
Contributor
There was a problem hiding this comment.
This test is already covered above.
ewinston
approved these changes
Mar 26, 2020
ajavadia
approved these changes
Mar 26, 2020
faisaldebouni
pushed a commit
to faisaldebouni/qiskit-terra
that referenced
this pull request
Aug 5, 2020
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PauliTablesymplectic operator class #3889 (on-hold until merged)Adds a
StabilizerTablesubclass ofPauliTablethat 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