7-Qubit Steane Code
The Steane code is a CSS stabilizer code built from the classical Hamming parity-check matrix. This repository implements state-vector encoding, separate X/Z syndrome extraction, and single-qubit Pauli recovery.
Parity-Check Matrix
steane_parity_check() returns:
1 0 1 0 1 0 1
0 1 1 0 0 1 1
0 0 0 1 1 1 1
The same matrix is used for Z-type and X-type stabilizer checks.
Logical States
encode_steane(alpha_beta) constructs |0_L> as the equal superposition over the eight codewords generated by the rows of the parity-check matrix. |1_L> is the bitwise complement superposition. The returned encoded state is:
alpha|0_L> + beta|1_L>
Stabilizers And Syndrome
stabilizers_for_code('steane') builds six generators:
- three Z-type checks from rows of the Hamming matrix,
- three X-type checks from the same rows.
syndrome_steane(psi) returns:
error.
error.
syn.x: the syndrome from Z checks, used to locate the X component of ansyn.z: the syndrome from X checks, used to locate the Z component of an
For a Y error, both syndrome parts are nonzero because Y has both X and Z components.
Recovery Flow
The high-level recovery helper is:
[psi_corr, syndrome] = recover_steane(psi_noisy);
correct_steane(psi, syndrome) converts each three-bit syndrome into a qubit index with binary_syndrome_index(...). It applies an X correction for syn.x and a Z correction for syn.z.
The tests verify recovery from every single-qubit X, Y, and Z error on an arbitrary encoded logical state.
Main Files
src/steane_parity_check.msrc/encode_steane.msrc/syndrome_steane.msrc/correct_steane.msrc/recover_steane.msrc/stabilizers_for_code.m
Examples
octave --no-gui examples/minimal_steane_recovery.m
Tests
The main checks live in:
tests/test_stabilizer_codes.m
Run them through:
octave --no-gui tests/run_all_tests.m
Current Limits
syndrome extraction model.
- Recovery is designed and tested for single-qubit Pauli errors.
- The code uses direct projective stabilizer measurements, not a circuit-level
- Transversal logical gates are not implemented.