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

Fix for Issue #240 #241

Merged
merged 5 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qiskit_qec/linear/symplectic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def all_commute(matrix: np.ndarray) -> bool:
>>> all_commute(matrix)
True
"""
test_mat = symplectic_product(matrix, matrix)
test_mat = np.asarray(symplectic_product(matrix, matrix))
dsvandet marked this conversation as resolved.
Show resolved Hide resolved
return not test_mat.any()


Expand Down
7 changes: 7 additions & 0 deletions tests/linear/test_symplectic.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def test_symplectic_product(self):
answer = 0
self.assertTrue(np.equal(result, answer).all())

# input a single Pauli

mat = np.array([1, 1, 0, 0], dtype=np.bool_)
result = symplectic_product(mat, mat)
answer = 0
self.assertTrue(answer == result)

def test_invalid_symplectic_product(self):
"""Tests invalid symplectic product."""
test_mata = [[2, 0, 1, 1], [0, 1, 1, 0]]
Expand Down