QuantumClifford.jl
QuantumClifford.jl copied to clipboard
Compactification can now optionally create a new module with much smaller sum types
The sumtype will contain only the gates that have been seen in the given circuit.
Benchmarks:
using BenchmarkTools
using QuantumClifford
function x_diag_circuit_noisy_measurement(csize)
circuit = []
for i in 1:csize
push!(circuit, PauliError(i, 0.1))
push!(circuit, sHadamard(i))
push!(circuit, sCNOT(i, csize+1))
push!(circuit, sMZ(csize+1,i))
push!(circuit, ClassicalXOR(1:(i%6+2),i))
end
return circuit
end
@benchmark pftrajectories(state,circuit) setup=(state=PauliFrame(1000, 1001, 1001); circuit=x_diag_circuit_noisy_measurement(1000)) evals=1
BenchmarkTools.Trial: 1190 samples with 1 evaluation.
Range (min … max): 3.341 ms … 4.404 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 3.373 ms ┊ GC (median): 0.00%
Time (mean ± σ): 3.383 ms ± 50.728 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▆▄▄▄▄▇█▄▂ ▂▄
▃▄▆██████████████▆▆▆▆▅▆▅▅▄▄▄▃▃▄▃▃▂▃▂▂▃▂▃▂▁▁▁▂▂▁▁▁▁▁▁▁▁▁▂▁▂ ▄
3.34 ms Histogram: frequency by time 3.51 ms <
Memory estimate: 281.25 KiB, allocs estimate: 6000.
@benchmark pftrajectories(state,circuit) setup=(state=PauliFrame(1000, 1001, 1001); circuit=compactify_circuit(x_diag_circuit_noisy_measurement(1000); subspecialize=false)) evals=1
BenchmarkTools.Trial: 1049 samples with 1 evaluation.
Range (min … max): 3.297 ms … 3.783 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 3.326 ms ┊ GC (median): 0.00%
Time (mean ± σ): 3.342 ms ± 57.815 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▆█▇▇█▇▅▅▄▂▄▁▁▁ ▁
▇██████████████▇▇▆▅▆▇▆▆▇▄▄▄▅▄▄▆▆▄▇▅▆▄▇▇▆▆▁▅▄▅▆▁▁▁▁▆▁▄▄▁▄▁▆ █
3.3 ms Histogram: log(frequency) by time 3.6 ms <
Memory estimate: 48 bytes, allocs estimate: 1.
circuit=compactify_circuit(x_diag_circuit_noisy_measurement(1000); subspecialize=false)
state=PauliFrame(1000, 1001, 1001)
@benchmark pftrajectories($state,$circuit)
BenchmarkTools.Trial: 1494 samples with 1 evaluation.
Range (min … max): 3.189 ms … 3.620 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 3.353 ms ┊ GC (median): 0.00%
Time (mean ± σ): 3.345 ms ± 48.549 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▂▆▄█▆▇▄▂▁
▃▂▂▃▃▃▃▃▃▄▃▃▃▃▃▂▂▃▂▂▂▁▂▂▁▁▁▂▃▅▆██████████▅▄▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂ ▃
3.19 ms Histogram: frequency by time 3.46 ms <
Memory estimate: 0 bytes, allocs estimate: 0.
circuit=compactify_circuit(x_diag_circuit_noisy_measurement(1000); subspecialize=true)
state=PauliFrame(1000, 1001, 1001)
@benchmark pftrajectories($state,$circuit)
BenchmarkTools.Trial: 1563 samples with 1 evaluation.
Range (min … max): 3.179 ms … 3.358 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 3.196 ms ┊ GC (median): 0.00%
Time (mean ± σ): 3.197 ms ± 11.439 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▄▇█▇▄▁
▂▁▂▂▃▃▄▇███████▆▄▃▄▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▂▂▁▁▁▁▂▂▂▂▂ ▃
3.18 ms Histogram: frequency by time 3.26 ms <
Memory estimate: 0 bytes, allocs estimate: 0.