Skip to content

Commit b627d58

Browse files
committed
decoding
1 parent b006b7e commit b627d58

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

examples/Nishimori/NishimorisCat.jl

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,7 @@
11
using MonitoredQuantumCircuits
22
import JLD2
33
import ProgressMeter
4-
function simulate(path::String; L=12, averaging=10)
5-
geometry = HoneycombGeometry(Periodic, L, L)
6-
7-
progressMeter = ProgressMeter.Progress(length(points) * averaging; dt=1.0)
8-
Threads.@threads for (px, py, pz) in points
9-
if type == :Kitaev
10-
circuit = compile(MeasurementOnlyKitaev(geometry, px, py, pz; depth))
11-
elseif type == :Kekule
12-
circuit = compile(MeasurementOnlyKekule(geometry, px, py, pz; depth))
13-
else
14-
throw(ArgumentError("Unsupported type $type. Choose one of :Kitaev, :Kekule"))
15-
end
16-
sim = QuantumClifford.TableauSimulator(nQubits(geometry))
17-
entropy = zeros(Float64, L+1)
18-
for _ in 1:averaging
19-
result = execute(circuit, sim)
20-
for l in 1:L+1
21-
entropy[l] += QuantumClifford.entanglement_entropy(result.stab, z_subsystems[l])
22-
entropy[l] += QuantumClifford.entanglement_entropy(result.stab, x_subsystems[l])
23-
entropy[l] += QuantumClifford.entanglement_entropy(result.stab, y_subsystems[l])
24-
end
25-
ProgressMeter.next!(progressMeter)
26-
end
27-
entropy ./= 3averaging
28-
JLD2.save(
29-
"$path/ENT_L=$(L)_px=$(px)_py=$(py)_pz=$(pz)_averaging=$(averaging)_depth=$(depth).jld2",
30-
"entropy", entropy,
31-
"probs", (px, py, pz))
32-
end
4+
function simulate(; path="", L=12, averaging=10)
5+
geometry = HoneycombGeometry(Open, L, L)
6+
circuit = compile(NishimorisCat(geometry))
337
end

src/circuit.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,18 @@ struct CompiledCircuit{Ops<:Tuple}
194194
pos.ancilla[i] = ancilla[h]
195195
end
196196
end
197+
nMeasurements = 0
198+
for p in pointer
199+
instruction = instructions[p]
200+
if typeof(instruction) <: MeasurementOperation
201+
nMeasurements += 1
202+
end
203+
end
197204

198205

199206

200207

201-
new{Ops}(operations, positions, instructions, n_qubits, maximum([a.second for a in ancilla]) - n_qubits, pointer, qubit_map_compiled_to_geometry, qubit_map_geometry_to_compiled, 0)
208+
new{Ops}(operations, positions, instructions, n_qubits, maximum([a.second for a in ancilla]) - n_qubits, pointer, qubit_map_compiled_to_geometry, qubit_map_geometry_to_compiled, nMeasurements)
202209
end
203210
end
204211

src/circuits/nishimoris_cat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function NishimorisCat(geometry::HoneycombGeometry{Open}; depth::Integer=100)
1+
function NishimorisCat(geometry::HoneycombGeometry{Open})
22
circuit = Circuit(geometry)
33

44
for position in 1:nQubits(geometry)

0 commit comments

Comments
 (0)