-
Notifications
You must be signed in to change notification settings - Fork 51
Refactor io.{h|cc} into other methods #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
oscarhiggott
approved these changes
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
oscarhiggott
added a commit
that referenced
this pull request
Aug 10, 2025
* Use UserGraph for MWPM creation instead of IntermediateWeightedGraph * Format user_graph.h * Flag-protect (unimplemented) correlated matching * Don't throw if correlations are enabled; Add perf tests * PR comment; Ensure backwards compatibility with C++ API * Remove pymatching binary * Fix CI * Fix CI * Fix pybind source files * Refactor io.* into user_graph.* (#125) Co-authored-by: Sid Madhuk <smadhuk@google.com> * Add method to iterate through a DEM which decomposes Hyper Edges * Small cleanup * pr comments: remove comments and rename variable * throw on decomposed errors with hyperedge components * extend: throw on probabilities greater than half * Track joint probabilities of correlated errors * clenaup: remove extra newline * pr feedback: keep edges sorted in the user_graph and joint_probabilities * Calculate implied edge weights from joint probabilities * remove unnecessary test * small cleanup * Populate implied edge weights in edges in the User Graph * Populate unconverted implied weights during matching graph creation * Convert implied weights for decoding * Implement reweight logic for the search and matching graphs * Pipe reweighting logic all the way to the Pymatching binary CLI * Pipe reweighting logic all the way to the Pymatching binary CLI * Clean up search graph logic so * Fix tests * Add correlated matching branches to methods missed in earlier PRs * Fix pybind * Update pybindings to handle correlations * 2 fixes: undo weights at end of shots; reweight search flooder * Fix edge reweighting logic * Fix test failures * Update src/pymatching/sparse_blossom/driver/user_graph.cc Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/driver/user_graph.cc Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/flooder/graph.cc Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/search/search_graph.cc Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/search/search_graph.h Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/driver/user_graph.cc Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * fix tests * Only discretize weights when converting to MatchingGraphs * Update src/pymatching/matching.py Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/matching.py Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/matching.py Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/matching.py Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Fix tests * fix formatting * Remove unused method * Update src/pymatching/sparse_blossom/driver/user_graph.h Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/driver/user_graph.h Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Update src/pymatching/sparse_blossom/driver/user_graph.h Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Make previously free edges to implied weights unconverted variable a class member * Add default new parameters to prevent breaking API changes * remove unused method * const ref for std::vector<ImpliedWeightUnconverted> * check implied weight validity when computing normalizing constant * return bool in get_edge_or_boundary_edge_weight and add test * pr comment: use SIZE_MAX instead of -1 for consistency * Add tests for correlations with pybind flow * Remove unused blob of code * Decode to edges array also allows correlated matching (#157) * Decode to edges array also allows correlated matching * format * Update src/pymatching/matching.py --------- Co-authored-by: Sid Madhuk <smadhuk@google.com> Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> * Check for invalid pymatching.Matching configuration when decoding with enable_correlations=True (#160) * Catch attempted decoding using enable_correlations=True when pymatching.Matching is not configured for correlations * add to docstrings on correlations expose enable_correlation flags to more loading methods * fix docstring * turn on decompose_errors in perf * decompose_errors in dem loading tests * test for exception with undecomposed hyperedge * flake8 * add enable_correlations to more docstrings * flake8 * update undecomposed hyperedges error * Ensure that pymatching CLI includes a search flooder for predict (#163) Co-authored-by: Sid Madhuk <smadhuk@google.com> * Correlated matching docs (#164) * correlated matching docs * readme --------- Co-authored-by: Sid Madhuk <smadhuk@google.com> Co-authored-by: oscarhiggott <29460323+oscarhiggott@users.noreply.github.com> Co-authored-by: Oscar Higgott <oscarhiggott@google.com>
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.
With the removal of the
IntermediateWeightedGraph
, we can move all of the code from theio.*
files intouser_graph.*
files. This also helps prepare thecorrelated-matching
dev branch for upcoming changes where a newiter_dem_include_correlations
method will depend on theUserEdge
insideuser_graph.h
and prevent circular dependencies if the new method lived beside the currently existing iter method insideio.h
.This PR is a no-op on performance.
Before:
After: