Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 23 additions & 0 deletions zixy-py/test/qubit/pauli/test_term_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
SignTerms,
String,
SymbolicTerm,
SymplecticPart,
X,
Y,
Z,
Expand Down Expand Up @@ -141,6 +142,28 @@ def test_sign_terms_canonicalize():
assert terms[0].string.get_tuple() == (X, I, X)
assert terms[1].string.get_tuple() == (I, X, X)
assert terms[2].string.get_tuple() == (Z, Z, Z)
# use manual canonicalization order to revert back
imul_ops = terms.canonicalize(
[(0, SymplecticPart.Z), (0, SymplecticPart.X), (2, SymplecticPart.X)], [0, 1, 2], []
)
correct_ops = [
# move Z0 up
(0, 2),
# eliminate Z0s
(2, 0),
# moveX0 up
(1, 2),
# eliminate X0s
(0, 1),
(2, 1),
# X2 already in place
# eliminate X2s
(0, 2),
]
assert imul_ops == correct_ops
assert terms[0].string.get_tuple() == tuples[0]
assert terms[1].string.get_tuple() == tuples[1]
assert terms[2].string.get_tuple() == tuples[2]

null = SignTerms(0)
# the unique tableau with 0 qubits is in canonical form, so no imuls
Expand Down
3 changes: 2 additions & 1 deletion zixy-py/zixy/qubit/pauli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
SymbolicTermSum,
)

from zixy._zixy import PauliMatrix, PauliSprings
from zixy._zixy import PauliMatrix, PauliSprings, SymplecticPart

I = PauliMatrix.I # noqa: E741
X = PauliMatrix.X # noqa: E741
Expand Down Expand Up @@ -74,4 +74,5 @@
"SymbolicTerms",
"SymbolicTermSet",
"SymbolicTermSum",
"SymplecticPart",
]
Loading