Skip to content

Expose subsystem_dressed_distance to Python - #528

Merged
ciaranra merged 5 commits into
devfrom
subsystem-distance-binding
Aug 16, 2026
Merged

Expose subsystem_dressed_distance to Python#528
ciaranra merged 5 commits into
devfrom
subsystem-distance-binding

Conversation

@ciaranra

Copy link
Copy Markdown
Member

Why

subsystem_dressed_distance (dressed distance of a subsystem/gauge code) shipped Rust-only in #415, noted as a follow-up. This adds the Python binding so it is usable alongside the other pecos.qec distance entry points.

What changed

  • pecos.qec.subsystem_dressed_distance(num_qubits, stabilizers, gauge_generators, logical_zs, logical_xs, max_weight) — a thin binding over the existing Rust function. It converts the four PauliString lists via the established .to_rust() path, returns DistanceResult | None, and maps SubsystemCodeError to ValueError. It inherits the Rust validation: an ill-formed spec (a logical anticommuting with a stabilizer, an invalid gauge/center split) raises rather than returning a wrong number.
  • pecos.qec.DistanceResult — a small result wrapper (distance, min_weight_operator), which did not previously exist as a standalone Python type (the exact stabilizer path surfaces DistanceResult only through its outcome enum). Added with .pyi stubs and __init__ exports.

Verification

  • Three Python regression tests: Bacon-Shor 3x3 -> dressed distance 3 (matching the Rust test), None past the weight budget, and a ValueError (matched on "anticommute") for a logical that anticommutes with a stabilizer/gauge.
  • cargo check -p pecos-rslib clean; cargo clippy --locked -p pecos-rslib --all-targets -- -D warnings, cargo fmt --all --check, and pre-commit run --all-files all clean.
  • Binding exercised end-to-end via just build-debug + the test suite.

…d local installer (#524)

* Install CUDA from verified redist components instead of the unverified local installer

* Reject CUDA component symlinks that resolve outside the install tree

* Lock the symlink-containment prefix trap with a regression test
@ciaranra
ciaranra merged commit a90ad52 into dev Aug 16, 2026
42 checks passed
@ciaranra
ciaranra deleted the subsystem-distance-binding branch August 16, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant