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
Copy file name to clipboardExpand all lines: src/qrisp/operators/qubit/qubit_operator.py
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -984,7 +984,8 @@ def change_of_basis(qarg):
984
984
# H X H = Z
985
985
# H Y H = -Y
986
986
# H Z H = X
987
-
# For the original Pauli terms this translates to: Factor (-1) appears if S gate is applied to Y, or Hadamard gate H is applied to Y. (No factor (-1) occurs if S*H is applied.)
987
+
# For the original Pauli terms this translates to: Factor (-1) appears if S gate is applied to Y, or Hadamard gate H is applied to Y
988
+
# No factor (-1) occurs if H S^{-1} P S H is applied (i.e., H and S) for any P in {X,Y,Z}
988
989
989
990
s_vector=np.zeros(m, dtype=int)
990
991
s_vector[s_list] =1
@@ -998,16 +999,25 @@ def change_of_basis(qarg):
998
999
999
1000
forindex,z_vectorinenumerate(R_inv.T):
1000
1001
1001
-
# Count the number of rows of the square submatrix A defined by z_vector (rows/columns), such that the number of 1's in each row is odd
1002
+
# Determine the sign of the product of the selected graph state stabilizers:
1003
+
#
1004
+
# Consider product of stabilizers S_{i_1}*S_{i_2}*...*S_{i_m} with (w.l.o.g.) i_1<i_2<...<i_m
1005
+
# For each i: Swap X_i with all Z_i's from stabilizers if index > i such that all Z_i's are on the left of X_i
1006
+
# Calculate the paritiy n1 of the sum of the numbers of 1's with position j>i for each row of the square submatrix A defined by z_vector
1007
+
# Yields a factor (-1)^n1
1008
+
1009
+
n1=sum((z_vector @ A_low)*z_vector) %2
1010
+
1011
+
# For each i: Count the number of Z_i's: if even, no factor, if odd: factor i (ZX=iY)
1012
+
# Count the number n2 of rows of the square submatrix of A defined by z_vector, such that the number of 1's in each row is odd
1002
1013
# This number is always even since A is a symmetric matrix with 0's on the diagonal
1003
-
n1=sum((z_vector @ A)*z_vector%2)
1014
+
# Yields a factor i^n2=(-1)^(n2/2)
1004
1015
1005
-
# Calculate the paritiy of the sum of the numbers of 1's with position j>i for each row of the square submatrix A defined by z_vector (rows/columns)
0 commit comments