Expand description
Rotated surface code with a minimum-weight perfect-matching (MWPM) decoder.
This module implements a distance-d rotated surface code (Fowler et al.,
“Surface codes: Towards practical large-scale quantum computation”, Phys.
Rev. A 86, 032324, 2012) together with a syndrome decoder, in the classical
Pauli-frame picture used by virtually every surface-code threshold study.
§Scope and conventions
Rather than carrying a 2^{d²}-amplitude state vector through the stabilizer
measurement schedule (which is unnecessary for tracking how Pauli errors map
to logical errors), we track an error as an independent pair of X/Z bit
masks over the d² data qubits — a PauliError. This is exact for Pauli
noise: a stabilizer’s syndrome bit is just the parity of the overlap between
the stabilizer support and the offending error component, and a residual
error commutes with every stabilizer iff it lies in the stabilizer group
(no logical error). All correctness statements below are made in this frame.
- Layout.
d²data qubits sit on ad × dgrid (indexr·d + c). Thed²−1stabilizers form the rotated checkerboard:(d−1)²weight-4 bulk plaquettes plus2(d−1)weight-2 boundary plaquettes.Z-type plaquettes detectXerrors;X-type plaquettes detectZerrors. There are exactly(d²−1)/2of each. - Decoder. For each error species we build the matching graph whose
nodes are the stabilizers of the detecting type plus one virtual boundary
node, and whose edges are data qubits. Decoding is an exact minimum-weight
perfect matching solved by subset (bitmask) dynamic programming over the
defect set — not the full stabilizer set — so the cost is
O(2^{k}·k)in the number of fired stabilizersk, which is tiny for the low-weight errors a distance-dcode is meant to handle. (A Blossom-V matching would be the drop-in replacement for high-weight syndromes at larged; the DP here is the same minimum-weight matching, just enumerated exactly.)
For a distance-d code this corrects every error of weight ≤ ⌊(d−1)/2⌋:
the residual error ∘ correction is a cycle of weight below d, hence a
product of stabilizers, hence logically trivial.
Structs§
- Pauli
Error - A Pauli error over the data qubits: independent
X(bit-flip) andZ(phase-flip) components.y = x · zon a qubit is represented by both bits being set. - Stabilizer
- A single stabilizer generator: its species and the data qubits it acts on.
- Surface
Code - A distance-
drotated surface code with an MWPM decoder. - Surface
Code Config - Configuration for a
SurfaceCode. - Syndrome
- The measured syndrome: one bit per stabilizer (
true= defect / fired).
Enums§
- Stab
Kind - Stabilizer species of a rotated-surface-code plaquette.