ECC example with Pauli Frames

The documentation is incomplete

Waiting for a better documentation than the small example below. Check out also the page on ECC performance evaluators

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)
+ ___XXXX
+ _XX__XX
+ X_X_X_X
+ ___ZZZZ
+ _ZZ__ZZ
+ Z_Z_Z_Z

... and the corresponding encoding circuit

ecirc = naive_encoding_circuit(code)
Example block output

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

scirc, _ = naive_syndrome_circuit(code)
(QuantumClifford.AbstractOperation[sXCX(4,8), sXCX(5,8), sXCX(6,8), sXCX(7,8), sMRZ(8, 1), sXCX(2,9), sXCX(3,9), sXCX(6,9), sXCX(7,9), sMRZ(9, 2)  …  sCNOT(2,12), sCNOT(3,12), sCNOT(6,12), sCNOT(7,12), sMRZ(12, 5), sCNOT(1,13), sCNOT(3,13), sCNOT(5,13), sCNOT(7,13), sMRZ(13, 6)], 6, 1:6)

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
4×6 Matrix{Bool}:
 0  0  0  0  0  0
 0  0  0  0  0  0
 0  0  0  0  0  0
 0  0  0  0  0  0

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...]
Example block output

And running this noisy simulation:

frames = pftrajectories(fullcircuit; trajectories=nframes)
pfmeasurements(frames)
4×6 Matrix{Bool}:
 0  0  0  0  0  0
 1  0  0  1  0  0
 0  0  0  0  0  0
 0  0  0  0  0  0