Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.04 KB

ecc_example_sim.md

File metadata and controls

65 lines (50 loc) · 2.04 KB

[ECC example with Pauli Frames](@id noisycircuits_pf_ecc_example)

DocTestSetup = quote
    using QuantumClifford
    using Quantikz
end
CurrentModule = QuantumClifford.Experimental.NoisyCircuits

!!! warning "The documentation is incomplete" Waiting for a better documentation than the small example below. Check out also the page on [ECC performance evaluators](@ref ecc_evaluating)

Consider Steane 7-qubit code:

using QuantumClifford
using QuantumClifford.ECC: Steane7, naive_syndrome_circuit, naive_encoding_circuit, parity_checks, code_s, code_n
using Quantikz

code = Steane7()
H = parity_checks(code)

... and the corresponding encoding circuit

ecirc = naive_encoding_circuit(code)

... and the corresponding syndrome measurement circuit (the non-fault tolerant one)

scirc, _ = naive_syndrome_circuit(code)

The most straightforward way to start sampling syndromes is to set up a table of Pauli frames.

circuit = [ecirc..., scirc...]
nframes = 4
frames = pftrajectories(circuit; trajectories=nframes) # run the sims
pfmeasurements(frames)                                 # extract the measurements

The pftrajectories function is multithreaded. If you want more low-level control over these Pauli frame simulations, check out the PauliFrame structure, the other methods of pftrajectories, and the circuit compactifaction function compactify_circuit.

If you want to model Pauli errors, use:

errprob = 0.1
errors = [PauliError(i,errprob) for i in 1:code_n(code)]
fullcircuit = [ecirc..., errors..., scirc...]

And running this noisy simulation:

frames = pftrajectories(fullcircuit; trajectories=nframes)
pfmeasurements(frames)