Skip to main content

Module mwpm

Module mwpm 

Source
Expand description

MWPM (Minimum-Weight Perfect Matching) decoder for the rotated surface code.

§Algorithm

In the surface code, syndrome ancillas form the nodes of a matching graph, and data qubits are the EDGES. Each data qubit connects exactly the 1 or 2 syndrome ancillas that contain it in their stabilizer support:

  • If qubit q is in 2 Z-stab supports (A and B), it is the edge A↔B.
  • If qubit q is in only 1 Z-stab support A, it is the edge A↔virtual_boundary. The boundary type (top/bottom/left/right) is determined by (row, col) of q.

We build this qubit→edge map, run Floyd-Warshall on the ancilla graph to get shortest distances, then run bitmask-DP MWPM on the defect subgraph.

Corrections are lifted by walking parent pointers in the ancilla graph.

Structs§

MwpmSurfaceDecoder
MWPM decoder for the rotated planar surface code.