← ClaudeAtlas

qector-pymatching-compatlisted

The PyMatching-compatible shim in qector-decoder-v3 (manual 17.1). Covers `qector_decoder_v3.pymatching_compat.Matching` as a drop-in for `pymatching.Matching`, the supported methods (from_check_matrix, from_detector_error_model, add_edge, add_boundary_edge, decode, decode_batch, decode_to_edges_array), the fact that it is backed by the exact Blossom decoder, the one-line import swap, and the smoke test pattern via `qector-research.pymatching_compat_check`. Load for any question about PyMatching compatibility, Stim / PyMatching pipelines, or a one-line decoder swap.
GuillaumeLessard/qector-claude-plugin · ★ 1 · AI & Automation · score 62
Install: claude install-skill GuillaumeLessard/qector-claude-plugin
# QECTOR PyMatching Compatibility Source of authority: v1.0.0 reference manual, section 17.1. ## The drop-in shim ```python import qector_decoder_v3.pymatching_compat as pm_qector # -or, more conventionally, alias the Matching class: from qector_decoder_v3.pymatching_compat import Matching ``` `Matching` is a drop-in for the subset of `pymatching.Matching` most code uses: - `Matching.from_check_matrix(H)` - build from a dense `(n_checks, n_qubits)` 0/1 matrix. - `Matching.from_detector_error_model(dem)` - build from a Stim detector error model. - `add_edge(u, v, weight=...)` - add an edge between detectors. - `add_boundary_edge(u, weight=...)` - add a boundary edge. - `decode(syndrome)` - decode a single binary syndrome. - `decode_batch(syndromes)` - decode a batch of syndromes. - `decode_to_edges_array(syndrome)` - return the matched edges as an array. It is backed by the **exact Blossom decoder**, so existing Stim / PyMatching pipelines swap in QECTOR with a one-line import change. ## Why the swap is safe - The QECTOR shim returns a correction that satisfies `H c = s (mod 2)` (Theorem 1) for reachable syndromes on graphlike codes. - The exact Blossom back-end is the same one the library `qector-decoder-v3.BlossomDecoder` exposes. - The supported method subset is the most-used surface; methods not listed are not part of the contract and may be absent from the shim. ## Smoke test pattern `qector-research.pymatching_compat_check` is a built-in smoke t