1- function simulate_QuantumClifford (L,n= 10 ;shots= 10 ,depth= 10 )
1+ function simulate_QuantumClifford (L,n= 10 ;shots= 10 ,depth= 10 ,type = :Kitaev )
22 g = HoneycombGeometry (Periodic, L, L)
3- ps = generateProbs (;n)
4- backend = QuantumClifford . TableauSimulator ( nQubits (g); mixed = true )
3+ ps = generateProbs (;n, offset = 0.01 )
4+
55
66 partitionsX = subsystems (g, 4 ; cutType= :X )
77 partitionsY = subsystems (g, 4 ; cutType= :Y )
88 partitionsZ = subsystems (g, 4 ; cutType= :Z )
99
1010 tmi = zeros (Float64, length (ps))
11- for (i, (px,py,pz)) in enumerate (ps)
11+ Threads. @threads for i in eachindex (ps)
12+ px,py,pz = ps[i]
13+ backend = QuantumClifford. TableauSimulator (nQubits (g); mixed= true )
1214 post = (s) -> begin
1315 tmi[i] += QuantumClifford. tmi (backend. state, partitionsX)
1416 tmi[i] += QuantumClifford. tmi (backend. state, partitionsY)
1517 tmi[i] += QuantumClifford. tmi (backend. state, partitionsZ)
1618 end
17- execute! (()-> measurementOnlyKitaev! (backend, g, px,py,pz; depth), backend, post; shots= shots)
19+ if type == :Kitaev
20+ execute! (()-> measurementOnlyKitaev! (backend, g, px,py,pz; depth), backend, post; shots= shots)
21+ elseif type == :Kekule
22+ execute! (()-> measurementOnlyKekule! (backend, g, px,py,pz; depth), backend, post; shots= shots)
23+ else
24+ throw (ArgumentError (" Unsupported type $type . Choose one of :Kitaev, :Kekule" ))
25+ end
1826 end
1927 return tmi ./= 3 shots
2028end
2129
22- function generateProbs (; n= 45 )
30+ function generateProbs (; n= 45 ,offset = 0.0 )
2331 points = Vector {NTuple{3,Float64}} (undef, n* (n + 1 ) ÷ 2 )
2432 m = 1
2533 for (k, i) in enumerate (range (0 , 1 , n))
@@ -32,5 +40,5 @@ function generateProbs(; n=45)
3240 end
3341 end
3442
35- return points
43+ return [p .- offset .* (p .- ( 1 / 3 , 1 / 3 , 1 / 3 )) for p in points]
3644end
0 commit comments