Skip to content

Commit c3546cd

Browse files
authored
implement sSQRTXX, sInvSQRTXX, sSQRTYY, sInvSQRTYY (#368)
1 parent d3f42d2 commit c3546cd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/QuantumClifford.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export
5252
sCNOT, sCPHASE, sSWAP,
5353
sXCX, sXCY, sXCZ, sYCX, sYCY, sYCZ, sZCX, sZCY, sZCZ,
5454
sZCrY, sInvZCrY, sSWAPCX, sInvSWAPCX, sCZSWAP, sCXSWAP, sISWAP, sInvISWAP,
55-
sSQRTZZ, sInvSQRTZZ,
55+
sSQRTZZ, sInvSQRTZZ, sSQRTXX, sInvSQRTXX, sSQRTYY, sInvSQRTYY,
5656
# Misc Ops
5757
SparseGate,
5858
sMX, sMY, sMZ, PauliMeasurement, Reset, sMRX, sMRY, sMRZ,

src/symbolic_cliffords.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ end
339339
@qubitop2 SQRTZZ (x1 , x1x2z1 , x2 , x1z2x2 , ~iszero((x1 & z1 & ~x2) | (~x1 & x2 & z2)))
340340
@qubitop2 InvSQRTZZ (x1 , x1x2z1 , x2 , x1z2x2 , ~iszero((x1 &~z1 & ~x2) | (~x1 & x2 &~z2)))
341341

342+
@qubitop2 SQRTXX (z1z2x1, z1 , z1x2z2, z2 , ~iszero((~x1 & z1 &~z2) | (~z1 &~x2 & z2)))
343+
@qubitop2 InvSQRTXX (z1z2x1, z1 , z1x2z2, z2 , ~iszero(( x1 & z1 &~z2) | (~z1 & x2 & z2)))
344+
345+
@qubitop2 SQRTYY (z1x2z2, x1z2x2, x1z1z2, x1x2z1, ~iszero((~x1 &~z1 & x2 &~z2) | ( x1 &~z1 &~x2 &~z2) | ( x1 &~z1 & x2 & z2) | ( x1 & z1 & x2 &~z2)))
346+
@qubitop2 InvSQRTYY (z1x2z2, x1z2x2, x1z1z2, x1x2z1, ~iszero(( x1 & z1 &~x2 & z2) | (~x1 & z1 & x2 & z2) | (~x1 & z1 &~x2 &~z2) | (~x1 &~z1 &~x2 & z2)))
347+
342348
#=
343349
To get the boolean formulas for the phase, it is easiest to first write down the truth table for the phase:
344350
for i in 0:15
@@ -405,6 +411,10 @@ LinearAlgebra.inv(op::sISWAP) = sInvISWAP(op.q1, op.q2)
405411
LinearAlgebra.inv(op::sInvISWAP) = sISWAP(op.q1, op.q2)
406412
LinearAlgebra.inv(op::sSQRTZZ) = sInvSQRTZZ(op.q1, op.q2)
407413
LinearAlgebra.inv(op::sInvSQRTZZ) = sSQRTZZ(op.q1, op.q2)
414+
LinearAlgebra.inv(op::sSQRTXX) = sInvSQRTXX(op.q1, op.q2)
415+
LinearAlgebra.inv(op::sInvSQRTXX) = sSQRTXX(op.q1, op.q2)
416+
LinearAlgebra.inv(op::sSQRTYY) = sInvSQRTYY(op.q1, op.q2)
417+
LinearAlgebra.inv(op::sInvSQRTYY) = sSQRTYY(op.q1, op.q2)
408418

409419
##############################
410420
# Functions that perform direct application of common operators without needing an operator instance

test/test_symcliff.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
@test CliffordOperator(inv(random_op), i) == inv(CliffordOperator(random_op, i))
7777
@test CliffordOperator(inv(SingleQubitOperator(random_op)), i) == inv(CliffordOperator(random_op, i))
7878
end
79+
end
7980

8081
@testset "Consistency checks with Stim" begin
8182
# see https://github.com/quantumlib/Stim/blob/main/doc/gates.md
@@ -113,5 +114,9 @@
113114
@test CliffordOperator(sInvISWAP) == C"-ZY -YZ IZ ZI"
114115
@test CliffordOperator(sSQRTZZ) == C"YZ ZY ZI IZ"
115116
@test CliffordOperator(sInvSQRTZZ) == C"-YZ -ZY ZI IZ"
117+
@test CliffordOperator(sSQRTXX) == C"XI IX -YX -XY"
118+
@test CliffordOperator(sInvSQRTXX) == C"XI IX YX XY"
119+
@test CliffordOperator(sSQRTYY) == C"-ZY -YZ XY YX"
120+
@test CliffordOperator(sInvSQRTYY) == C"ZY YZ -XY -YX"
116121
end
117122
end

0 commit comments

Comments
 (0)