You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import qiskit_qec.linear.symplectic as symp
a = Pauli('XX')
symp.normalizer(a.matrix)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Untitled-1.ipynb Cell 10' in <cell line: 1>()
----> [1](vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#ch0000009untitled?line=0) symp.normalizer(a.matrix)
File ~/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py:2049, in normalizer(matrix, x, z, min_gen)
[2047](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=2046) if min_gen:
[2048](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=2047) matrix = min_generating(matrix)
-> [2049](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=2048) if is_stabilizer_group(matrix):
[2050](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=2049) return _normalizer_abelian_group(matrix)
[2051](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=2050) else:
File ~/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py:1191, in is_stabilizer_group(matrix)
[1189](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=1188) if not is_symplectic_matrix_form(matrix):
[1190](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=1189) raise QiskitError("Input matrix not a GF(2) symplectic matrix")
-> [1191](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=1190) return all_commute(matrix)
File ~/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py:54, in all_commute(matrix)
[27](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=26) r"""Determines if each possible pair of different rows of the
[28](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=27) GF(2) symplectic matrix have zero symplectic product. If the rows represent
[29](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=28) Pauli operators then the this method deterimes if the operators
(...)
[51](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=50) True
[52](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=51) """
[53](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=52) test_mat = symplectic_product(matrix, matrix)
---> [54](file:///Users/dsvandet/Software/Public/working/qiskit-qec/qiskit_qec/linear/symplectic.py?line=53) return not test_mat.any()
AttributeError: 'int' object has no attribute 'any'
What is the current behavior?
As above.
What is the expected behavior?
Should return the normalizer of the group generated by $X_0X1$ in the 2-qubit Pauli Group.
How to fix
The problem lies with the check in the normalizer method checking that the input matrix represents a set of commuting operators. The check runs symplectic_product(matrix, matrix) but since matrix is a vector in this example the current returned result is an integer and thus lacks an any method.
Fix: Apply np.asarray() to the result of the symplectic product
Unit tests
I unit test should be added to include this case - single generator (single row matrix)
The text was updated successfully, but these errors were encountered:
Steps to reproduce the problem
What is the current behavior?
As above.
What is the expected behavior?
Should return the normalizer of the group generated by$X_0X1$ in the 2-qubit Pauli Group.
How to fix
The problem lies with the check in the normalizer method checking that the input matrix represents a set of commuting operators. The check runs
symplectic_product(matrix, matrix)
but since matrix is a vector in this example the current returned result is an integer and thus lacks anany
method.Fix: Apply
np.asarray()
to the result of the symplectic productUnit tests
I unit test should be added to include this case - single generator (single row matrix)
The text was updated successfully, but these errors were encountered: