Expand description
Surface Code Error Correction Simulation
Simulates a distance-3 rotated surface code with:
- 9 data qubits (3 x 3 grid)
- 4 X-type stabilizers (plaquettes, detect Z errors)
- 4 Z-type stabilizers (vertices, detect X errors)
- 8 ancilla qubits (one per stabilizer)
Each QEC cycle performs:
- Noise injection – random Pauli errors on data qubits.
- Stabilizer measurement – entangle ancillas with data qubits and measure the ancillas to extract the error syndrome.
- Decoding – a simple lookup decoder maps the syndrome to a correction (placeholder; production systems would use MWPM).
- Correction – apply compensating Pauli gates.
§Qubit layout (distance 3)
Data qubits: Ancilla assignment:
d0 d1 d2 X-anc: 9, 10, 11, 12
d3 d4 d5 Z-anc: 13, 14, 15, 16
d6 d7 d8X stabilizers (plaquettes):
- X0 (anc 9): {d0, d1, d3, d4}
- X1 (anc 10): {d1, d2, d4, d5}
- X2 (anc 11): {d3, d4, d6, d7}
- X3 (anc 12): {d4, d5, d7, d8}
Z stabilizers (boundary vertices):
- Z0 (anc 13): {d0, d1}
- Z1 (anc 14): {d2, d5}
- Z2 (anc 15): {d3, d6}
- Z3 (anc 16): {d7, d8}
Structs§
- Surface
Code Config - Configuration for a surface code error correction simulation.
- Surface
Code Layout - Physical layout of a surface code: which data qubits participate in each stabilizer, and the ancilla qubit assigned to each stabilizer.
- Surface
Code Result - Result of a surface code simulation.
Functions§
- run_
surface_ code - Run a surface code error correction simulation.