Skip to content

Stim DetectorErrorModel Support

ILPQEC parses Stim DetectorErrorModels into an ILP by extracting the error(p) mechanisms and building parity-check and observable matrices.

Supported Instructions

  • error(p) ... lines are parsed. Tags in error[...] are ignored.
  • detector and logical_observable metadata lines are ignored.
  • shift_detectors offsets are applied.
  • repeat blocks are flattened by default (flatten_dem=True).
  • detector_separator is unsupported and raises an error.

The ^ Separator

Stim uses ^ to describe alternative components of a correlated mechanism. ILPQEC currently treats ^ as whitespace, which discards the alternative structure. If your DEM contains ^, prefer decompose_errors=True when building the DEM so each error is a single unambiguous mechanism.

Flattening and Size

Flattening expands repeat blocks and applies shift_detectors. This is convenient for parsing but can increase the DEM size significantly. To fail fast instead, pass flatten_dem=False when creating the decoder.

Recommendations

  • Use decompose_errors=True when constructing DEMs from Stim circuits.
  • Use flatten_dem=True unless the DEM is very large, and then pre-flatten only when needed.