Repository navigation
v0.4.0
qLDPC v0.4.0
qLDPC v0.4.0 is a large release.
It adds a typed decoder API, new code families and groups, exact and GPU-accelerated distance methods, more flexible circuit and noise tooling, and an experimental lattice-surgery package.
It also fixes many correctness bugs.
Changes marked
Major changes
Python 3.11 or later required
⚠️ qLDPC now requires Python 3.11 or later, because Python 3.10 reaches end of life in October 2026.
New decoder API
- Decoders are now chosen with typed specs:
decoders.bp_osd,bp_lsd,bf,mwpm,relay_bp,min_sum_bp,lookup_table,ilp, andguf.- Pass a spec as
decoder=..., or call.build(pcm_or_dem)to get a decoder. - For example,
decoder=decoders.bp_lsd(max_iter=30)replaceswith_BP_LSD=True, max_iter=30.
- Observable decoders predict logical-observable flips directly. Code-capacity estimation also supports them.
- Correlated matching through PyMatching:
decoders.mwpm(enable_correlations=True). LookupDecoderuses much less memory and decodes faster under Sinter.qldpc.decodersis reorganized into subpackages:adapters,construction,custom,external, andsinter.⚠️ The v0.3.3 keyword API still works but emits aDeprecationWarningthat names the replacement. This coverswith_<NAME>=True,decoder_x_kwargs/decoder_z_kwargs, and the uppercase builders such asget_decoder_BP_OSD.⚠️ These changes take effect without a deprecation period:static_decoderis removed, except from the deprecateddecoders.get_decoderanddecoders.decode. Pass a prebuilt decoder asdecoder=instead.decoder_x_kwargsanddecoder_z_kwargsnow take precedence over shared keyword arguments.- A
SinterDecoderbuilt frommwpm,relay_bp,min_sum_bp, orlookup_tablesettings now uses native observable prediction. Formwpmandlookup_table, its.decoderattribute is therefore an observable decoder. - The internal module
qldpc.decoders.retrievalno longer exists. Import its functions fromqldpc.decoders.
See "Migrating from qLDPC 0.3.3" in the decoder documentation for the full mapping.
Code distance
- Exact Brouwer–Zimmermann distance for CSS codes (
codes.get_distance_css_brouwer_zimmermann), with substantial speedups. CSSCode.get_distance_boundtakes a typedbackend=selector:"auto","gap","sqetch", or"decoder".- An optional GPU-accelerated random-ISD backend through
sqetch.
sqetchis not on PyPI, so install it separately as described in the README. ⚠️ Numba acceleration is removed, along with alluse_numbaarguments.
Exact binary distance calculations always use NumPy bit counting.
New code families and algebra
- New codes:
GALACode.QuantumReedMullerCode: self-orthogonal CSS Reed–Muller codes with closed-form distance.
- New groups:
GeneralLinearGroup(GL).ProjectiveGeneralLinearGroup(PGL).WreathProductGroup.
- Groups gain tensor-product lifts, natural permutation lifts, and
Group.degree.Group.liftnow normalizes member degrees. RingArraymoved to the newabstract.ring_arraymodule, and its matrix multiplication is faster. The old import paths still work.⚠️ qldpc.abstract.GF2is removed. Usegalois.GF2.
Circuits and noise models
- Circuit utilities accept any stim-wrapping circuit through
circuits.StimCircuitLikeandStimCircuitProtocol. This includestsimcircuits. - Explicit idle markers can carry configurable noise.
- Operation immunity and qubit immunity are now separate controls (
DEFAULT_IMMUNE_OP_TAG,DEFAULT_IMMUNE_QUBIT_TAG). - New
circuits.validate_syndrome_qubit_ids. ⚠️ Theqldpc[tsim]extra is removed. Installbloqade-tsimdirectly if you need it.
GAP integration
- New
qldpc[gap]extra that runs GAP in-process through PassageMath libgap. It is not available on Windows or on Python 3.15 and later. - If GUAVA or QDistRnd is missing, qLDPC can install it through GAP's PackageManager.
If that fails, qLDPC falls back to a separate GAP executable. - GAP now encodes extension-field elements correctly.
Experimental lattice surgery
- New
qldpc.experimentalpackage, starting with qLDPC lattice surgery. - Everything under
qldpc.experimentalis unstable and may change without a deprecation period. - Lattice-surgery support has not yet had independent expert review.
Validate its results independently, and pin the qLDPC version if you depend on it.
Minor changes
API additions and conveniences
AbstractCodeaccepts boolean inputs.- Pauli-valued
X/Zparameters also accept strings. - New
codes.DistanceBackend,DistanceMethod,validate_distance_backend, andvalidate_distance_method. - Deprecation warnings for old code aliases.
Bug fixes
- Codes:
- Logical operators for non-CSS subsystem codes.
conjugated()over odd characteristic, which now goes throughsymplectic_conjugate.- Quasi-cyclic codes with trivial cyclic order or coinciding monomials.
- Code constructions in degenerate and non-binary regimes.
- Trivial parity checks now get a Tanner-graph vertex.
- The graph product no longer drops qudits.
- Algebra:
- Howell duals over commutative and non-commutative rings, which affected canonical logicals of
LPCode/SLPCode. - Group-algebra tensor products.
- Parsing of qudit operators.
- Howell duals over commutative and non-commutative rings, which affected canonical logicals of
- Code-capacity estimation: the logical-error-rate estimation was reworked and its error bars fixed.
- Decoders:
- Unsupported erasure-bit requests are rejected consistently.
- Validation of decoder and algebraic inputs.
- Circuits: correctness and robustness fixes.
Packaging and dependencies
- New core dependency:
tqdm. pymatching>=2.3(previously>=2.1).relay-bpis pinned to 0.2.2.- Packaging hardened, with license files included in distributions.
Documentation and tooling
- New library map and contributor/agent guide.
- Rewritten README.
- Improved example notebooks, plus a new example on the logical error rates of individual observables.
- Fixed API-docstring rendering.
- Stricter quality gates: focused lint rules, a modular 100% statement-coverage gate, and a strict documentation build.
- Lighter CI dependency installation.