qec-code
qec-code provides Rust data structures and algorithms for constructing and
analyzing quantum error-correcting codes. Its dependency-facing APIs include:
- CSS matrix validation and construction;
- exact distance through optional HiGHS or Gurobi ILP backends;
- randomized CSS distance upper bounds;
- packed GF(2) row operations, reduced row spaces, and reusable kernel
workspaces under
qec_code::packed_gf2; and - exact Pauli phases, signed stabilizer groups, and caller-supplied logical
bases under
qec_code::phased_pauli.
Installation
Add the library from crates.io:
[]
= "0.4.0"
Enable the open-source exact ILP backend only when it is needed:
= { = "0.4.0", = ["distance-ilp-highs"] }
The default build is a library-only build with no command-line parser or native solver dependency. Available opt-in features are:
cliexposesqec_code::cliand builds theqec-codebinary;distance-ilp-highsenables exact distance with HiGHS; anddistance-ilp-gurobienables exact distance with Gurobi without also pulling in HiGHS.
Applications that previously invoked the package binary or imported
qec_code::cli must add features = ["cli"]. Features compose, so a CLI using
HiGHS can enable both cli and distance-ilp-highs.
This crate is covered by the repository-wide Apache-2.0 license, which is also declared in the workspace package metadata. Enable the distance features above only when needed.
Deterministic regular matrices
qec_code::regular_classical provides the versioned pure-Rust generator for
regular binary parity-check matrices used by random code families. The exact
version-1 stream, bounded-index rule, retry behavior, and seed-7 fixture are
documented in doc/regular_classical.md.
Packed GF(2) example
use ;
let generators = vec!;
let space = from_dense_rows?;
let target = from_dense?;
assert!;
# Ok::
The public wrappers intentionally hide the packed storage layout so internal elimination code can evolve without breaking downstream crates.
Signed stabilizer algebra
phased_pauli represents i^phase X^x Z^z, with Y = i XZ. Its
SignedStabilizerGroup checks generator signs as well as X/Z support, accepts
consistent redundant checks, and returns original-generator product witnesses
for exact membership. validate_logical_basis retains the caller's ordered,
signed logical representatives. See
examples/signed_stabilizer.rs for a public
API example that needs no CLI or solver feature.
These checks establish algebraic code and basis validity and signed group membership. They do not establish correctness of an entire compiled circuit.