Skip to content

Commit 65ce6e5

Browse files
committed
working
1 parent 5376e4e commit 65ce6e5

File tree

116 files changed

+3504
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3504
-1894
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["Quinten Preiss"]
44
version = "0.1.0-DEV"
55

66
[deps]
7+
AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a"
78
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
89
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
910
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
@@ -34,6 +35,7 @@ MonitoredQuantumCircuitsMPIExt = "MPI"
3435
MonitoredQuantumCircuitsMakieExt = "Makie"
3536

3637
[compat]
38+
AllocCheck = "0.2.2"
3739
CSV = "0.10.14"
3840
CUDA = "5.7.2"
3941
DataFrames = "1.6.1"

examples/2D_GHZ/simulation.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function simulate_QuantumClifford(;shots=10000,postselect=false)
2+
g = IBMQ_Falcon()
3+
backend = QuantumClifford.TableauSimulator(nQubits(g);
4+
mixed=false, basis=:Z)
5+
6+
magnetization = Int64[]
7+
p = (s) -> begin
8+
if postselect && all(i->i==0, (@view backend.measurements[1:11])) || !postselect
9+
push!(magnetization, sum(i->2*i-1, (@view backend.measurements[12:end])))
10+
end
11+
end
12+
execute!(()->monitoredGHZ!(backend, g; tApi=1/4), backend, p; shots=shots)
13+
return magnetization
14+
end
15+
16+
function simulate_Qiskit(;shots=10000,postselect=false)
17+
g = IBMQ_Falcon()
18+
backend = Qiskit.CliffordSimulator(nQubits(g);ancillas=nControlQubits(g))
19+
20+
magnetization = Int64[]
21+
p = (s) -> begin
22+
measurements = Qiskit.get_measurements(backend, s)
23+
if postselect && all(i->i==0, (@view measurements[1:11])) || !postselect
24+
push!(magnetization, sum(i->2*i-1, measurements[12:end]))
25+
end
26+
end
27+
execute!(()->monitoredGHZ!(backend, g; tApi=1/4), backend, p; shots=shots)
28+
return magnetization
29+
end

examples/Honeycomb/simulation.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function simulate_QuantumClifford(L,n;shots=10000,depth=100)
2+
g = HoneycombGeometry(Periodic, L, L)
3+
ps = generateProbs(;n)
4+
backend = QuantumClifford.TableauSimulator(nQubits(g); mixed=true)
5+
6+
partitionsX = subsystems(g, 4; cutType=:X)
7+
partitionsY = subsystems(g, 4; cutType=:Y)
8+
partitionsZ = subsystems(g, 4; cutType=:Z)
9+
10+
tmi = zeros(Float64, length(ps))
11+
for (i, (px,py,pz)) in enumerate(ps)
12+
post = (s) -> begin
13+
tmi[i] += QuantumClifford.tmi(backend.state, partitionsX)
14+
tmi[i] += QuantumClifford.tmi(backend.state, partitionsY)
15+
tmi[i] += QuantumClifford.tmi(backend.state, partitionsZ)
16+
end
17+
execute!(()->measurementOnlyKitaev!(backend, g, px,py,pz; depth), backend, post; shots=shots)
18+
end
19+
return tmi ./= 3shots
20+
end
21+
22+
function generateProbs(; n=45)
23+
points = Vector{NTuple{3,Float64}}(undef, n*(n + 1) ÷ 2)
24+
m = 1
25+
for (k, i) in enumerate(range(0, 1, n))
26+
for j in range(i, 1, n - k + 1)
27+
px = i
28+
py = j - i
29+
pz = 1 - j
30+
points[m] = (px, py, pz)
31+
m += 1
32+
end
33+
end
34+
35+
return points
36+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function simulate_QuantumClifford(L,ps;shots=10000,depth=100)
2+
g = ChainGeometry(Periodic, L)
3+
backend = QuantumClifford.TableauSimulator(nQubits(g); mixed=false, basis=:X)
4+
5+
entanglement = zeros(Float64, length(ps))
6+
for (i, p) in enumerate(ps)
7+
post = (s) -> begin
8+
entanglement[i] += QuantumClifford.entanglement_entropy(backend.state, 1:div(L,2))
9+
end
10+
execute!(()->monitoredTransverseFieldIsing!(backend, g, p; depth), backend, post; shots=shots)
11+
end
12+
13+
return entanglement ./= shots
14+
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)