Expose subsystem_dressed_distance to Python - #528
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 otherpecos.qecdistance 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 fourPauliStringlists via the established.to_rust()path, returnsDistanceResult | None, and mapsSubsystemCodeErrortoValueError. 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 surfacesDistanceResultonly through its outcome enum). Added with.pyistubs and__init__exports.Verification
Nonepast the weight budget, and aValueError(matched on "anticommute") for a logical that anticommutes with a stabilizer/gauge.cargo check -p pecos-rslibclean;cargo clippy --locked -p pecos-rslib --all-targets -- -D warnings,cargo fmt --all --check, andpre-commit run --all-filesall clean.just build-debug+ the test suite.