Skip to content

Commit

Permalink
add SQRTXX, SQRTYY, and their inverses
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Sep 24, 2024
1 parent 05491d9 commit eb1acfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/symbolic_cliffords.jl
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ end
@qubitop2 ZCrY (x1, x1z1x2z2, x1x2, x1z2, ~iszero((x1 & ~z1 & x2) | (x1 & ~z1 & ~z2) | (x1 & x2 & ~z2)))
@qubitop2 InvZCrY (x1, x1z1x2z2, x1x2, x1z2, ~iszero((x1 & z1 & ~x2 & ~z2) | (x1 & ~z1 & ~x2 & z2) | (x1 & z1 & ~x2 & z2) | (x1 & z1 & x2 & z2)))

@qubitop2 SQRTXX (z1z2x1, z1 , z1x2z2, z2 , ~iszero((~x1 & z1 &~z2) | ( ~z1 &~x2 & z2)))
@qubitop2 InvSQRTXX (z1z2x1, z1 , z1x2z2, z2 , ~iszero((x1 & z1 & ~z2) | ( ~z1 & x2 & z2)))

@qubitop2 SQRTYY (z1x2z2, x1z2x2, x1z1z2, x1x2z1, ~iszero((~x1 &~z1 & x2 &~z2) | ( x1 &~z1 &~x2 &~z2) | ( x1 &~z1 & x2 & z2) | ( x1 & z1 & x2 &~z2)))
@qubitop2 InvSQRTYY (z1x2z2, x1z2x2, x1z1z2, x1x2z1, ~iszero(( x1 & z1 &~x2 & z2) | (~x1 & z1 & x2 & z2) | (~x1 & z1 &~x2 &~z2) | (~x1 &~z1 &~x2 & z2)))

#=
To get the boolean formulas for the phase, it is easiest to first write down the truth table for the phase:
for i in 0:15
Expand Down Expand Up @@ -384,6 +390,10 @@ LinearAlgebra.inv(op::sYCY) = sYCY(op.q1, op.q2)
LinearAlgebra.inv(op::sYCZ) = sYCZ(op.q1, op.q2)
LinearAlgebra.inv(op::sZCrY) = sInvZCrY(op.q1, op.q2)
LinearAlgebra.inv(op::sInvZCrY) = sZCrY(op.q1, op.q2)
LinearAlgebra.inv(op::sSQRTXX) = sInvSQRTXX(op.q1, op.q2)
LinearAlgebra.inv(op::sInvSQRTXX) = sSQRTXX(op.q1, op.q2)
LinearAlgebra.inv(op::sSQRTYY) = sInvSQRTYY(op.q1, op.q2)
LinearAlgebra.inv(op::sInvSQRTYY) = sSQRTYY(op.q1, op.q2)

##############################
# Functions that perform direct application of common operators without needing an operator instance
Expand Down
1 change: 1 addition & 0 deletions test/test_symcliff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
@test CliffordOperator(inv(random_op), i) == inv(CliffordOperator(random_op, i))
@test CliffordOperator(inv(SingleQubitOperator(random_op)), i) == inv(CliffordOperator(random_op, i))
end
end

@testset "Consistency checks with Stim" begin
# see https://github.com/quantumlib/Stim/blob/main/doc/gates.md
Expand Down

0 comments on commit eb1acfa

Please sign in to comment.