Repository navigation
stabilizer-qec 1.2.0
The Python package and the Rust crate both at 1.2.0: circuits built in code, error models
with their loops folded as Stim folds them (long memories that 1.1 refused now build in a
tenth of a second), the crate level with the Python package, and wheels for free-threaded
Python, musl Linux and Windows on ARM.
Added
-
Circuits built in code, as in Stim, in Python and in the crate.
Circuit.append(name, targets, arg, tag=...)takes an instruction a time: targets as qubit indices, Stim's target
text ("rec[-1]","!3","X0","*") orstim.GateTargets, and whole Stim circuits,
instructions and repeat blocks;+and+=join circuits,*and*=make aREPEAT
block (multiplying the count of a circuit that is one loop, as Stim does);
append_from_stim_program_textandcopy. In Rust:Circuit::new,appendwith the new
TargetandPaulitypes,append_tagged,append_text,append_circuit,repeated, and
the operators+,+=,*,*=. A failed append leaves the circuit unchanged. -
Error models with their loops folded, as Stim folds them. The model is built by walking the
circuit's structure backwards with sparse sensitivity sets, finding where a loop's state
repeats (tortoise and hare, as Stim's error analyzer), and writing one period as arepeat
block. A d = 11 rotated memory of 10,000 rounds, which 1.0 refused, now builds in about 0.1 s
and prints in 15,000 lines, its structure (therepeatblocks, the declarations, and the
faults between them) equal to Stim's. Checked against Stim on its generated memories
(rotated, unrotated, repetition and color codes), nested and tagged loops, and random
circuits in loops. -
DetectorErrorModel.flattened()(Python and Rust), Stim's: the model withoutrepeat
blocks orshift_detectors.Circuit.detector_error_model(flatten_loops=True)(and
DemOptions::flatten_loops) walks every pass instead of folding. -
Models are held as written,
repeatblocks and all: Stim's folded models read without
unrolling, and are counted through their loops. A decoder unrolls its model once, up to
2²⁴ faults and declarations. -
The crate catches up with the Python package:
BivariateBicycleCode::automorphisms(each
shift's and duality's action on the logical qubits, asAutomorphisms),
BivariateBicycleCode::gauging(the ancilla system measuring a gross-code logical, as a
Gauging), andstream_memory(a memory streamed round by round and window-decoded, as a
StreamResult). The Python package and the crate now share the streaming loop. -
Wheels for free-threaded CPython 3.14 (cp314t), musl Linux (x86_64 and aarch64) and
Windows on ARM. The module declares it does not need the GIL, and every object can be
shared between threads: decoders decode from many threads at once, and threads sharing a
sampler draw disjoint batches of its stream. CI runs the suite on free-threaded 3.14. -
CITATION.cff,SECURITY.md,CONTRIBUTING.md, and Dependabot for the workflows and the
crate's dependencies.
Fixed
- Two threads sampling from one
DetectorSamplerno longer raise "Already mutably borrowed":
each call reserves its batches before it samples.
Changed
- PyO3 0.29 (from 0.22), for Python 3.14 and free threading.
- A built model prints as Stim prints one: errors first in each stretch, then detector
declarations with coordinates,logical_observableonly where needed, and loops folded.
Decoders take a model's faults in the order it is written, so a model, its text, and its
pickle decode alike. Within a fault, pieces are listed in sorted order, where Stim lists
them in the order they arose and so lists one fault once per order; the faults are the
same, andnum_errorscounts ours. - A circuit that reads a measurement record before its first measurement can now be made (it
may be a piece of a larger circuit, a round comparing with the last); sampling it, building
its error model or converting its measurements is the error, as in Stim. Counts are combined
piece by piece, so building a circuit an instruction at a time stays linear.