Repository navigation
Conversation
… decode When many syndromes of the same check matrix are decoded with different weights, building a new Matching per shot costs far more than the decode. PersistentMatcher builds the UserGraph and Mwpm once, as Matching.from_check_matrix does, and set_weights rewrites the edge weights in place, reproducing the smallest-weight merge, the discretisation and the negative-weight bookkeeping of a rebuild; decode returns the same result as a freshly built Matching.
Author
|
@oscarhiggott bump |
Author
|
Bump again? |
This branch has not been deployed
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.
Adds
pymatching.PersistentMatcher, for decoding many syndromes of the same check matrix with different weights on every shot (for example per-shot soft information). Today each new weight vector needs a newMatching, and building it costs far more than the decode.PersistentMatcherbuilds the matching graph once and rewrites its weights in place: 17–21× faster per shot, with outputs identical toUsage
Scope: the defaults of
Matching.from_check_matrix(merge_strategy="smallest-weight", no virtual boundary node, one repetition), weights rather than error probabilities, at most two non-zero elements per column. Weights may be negative.Speed
Per shot, with new weights every shot. Surface-code X checks, weights
log((1 - p) / p)with p drawn per fault in [0.005, 0.05]; Linux x86-64, one thread. Every output was checked againstMatching: all identical.Matchingper shotPersistentMatcherValidation
tests/matching/persistent_matcher_test.pycompares against a freshly builtMatchingon every shot: repetition, surface and toric codes, parallel edges, negative and integer weights, 1 to 70 observables, input validation.How it works
src/pymatching/sparse_blossom/driver/persistent.pybind.ccbuilds theUserGraphandMwpmexactly asfrom_check_matrixdoes, then records, for every user edge, the columns merged into it and the slots of its weight in the matching graph's adjacency lists.set_weightsredoes what a rebuild would do with the new weights:UserGraph::iter_discretized_edges, with the normalising constant ofget_edge_weight_normalising_constant(no rescaling when all weights are integers);MatchingGraph::add_edge/add_boundary_edge, thensync_negative_weight_observables_and_detection_eventsasto_mwpmdoes;The graph's structure (nodes, neighbour order) does not depend on the weights, so this reproduces a rebuild. A thin Python class (
src/pymatching/persistent_matcher.py) validates the inputs.Co-authored with Claude (Anthropic).