Adds 'pymatching-correlated' Sinter decoder#1012
Open
oscarhiggott wants to merge 1 commit intoquantumlib:mainfrom
Open
Adds 'pymatching-correlated' Sinter decoder#1012oscarhiggott wants to merge 1 commit intoquantumlib:mainfrom
oscarhiggott wants to merge 1 commit intoquantumlib:mainfrom
Conversation
…_correlations=True` mode in pymatching (two-pass correlated matching).
**Changes Introduced:**
* **`glue/sample/src/sinter/_decoding/_decoding_pymatching.py`**:
* The `PyMatchingDecoder` and `PyMatchingCompiledDecoder` classes were extended to accept and utilize a `use_correlated_decoding` boolean flag.
* When `use_correlated_decoding` is enabled, the `enable_correlations=True` argument is passed to `pymatching.Matching.from_detector_error_model` during decoder compilation.
* Support for correlated decoding via the file-based interface (`decode_via_files`) was implemented by passing the `--enable_correlations` flag to the `pymatching.cli` command.
* A version check was added to ensure `pymatching` version 2.3.1 or greater is installed when `use_correlated_decoding` is requested. An error message is shown if the version is insufficient (I chose v2.3.1 as that version introduced a minor bug fix in correlated matching).
* **`glue/sample/src/sinter/_decoding/_decoding_all_built_in_decoders.py`**:
* The 'pymatching-correlated' decoder, configured with `use_correlated_decoding=True`, was added to the `BUILT_IN_DECODERS` dictionary.
* **`glue/sample/src/sinter/_decoding/_decoding.py`**:
* The docstring for the `sample_decode` function was updated to include 'pymatching-correlated' in the list of available decoders.
* **`glue/sample/requirements.txt`**:
* Added `packaging` as a dependency, as it is used for robust version parsing in the new `pymatching` version check.
**Testing Adjustments (`glue/sample/src/sinter/_decoding/_decoding_test.py`):**
* **`test_post_selection`**: This test now explicitly skips the 'pymatching-correlated' decoder. This is because the test circuit contains error probabilities greater than 0.5, which are incompatible with PyMatching's correlated matching (`from_detector_error_model` raises an error in this scenario).
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 a 'pymatching-correlated' Sinter decoder, which uses the
enable_correlations=Truemode in pymatching (two-pass correlated matching).Changes Introduced:
glue/sample/src/sinter/_decoding/_decoding_pymatching.py:PyMatchingDecoderandPyMatchingCompiledDecoderclasses were extended to accept and utilize ause_correlated_decodingboolean flag.use_correlated_decodingis enabled, theenable_correlations=Trueargument is passed topymatching.Matching.from_detector_error_modelduring decoder compilation.decode_via_files) was implemented by passing the--enable_correlationsflag to thepymatching.clicommand.pymatchingversion 2.3.1 or greater is installed whenuse_correlated_decodingis requested. An error message is shown if the version is insufficient (I chose v2.3.1 as that version introduced a minor bug fix in correlated matching).glue/sample/src/sinter/_decoding/_decoding_all_built_in_decoders.py:use_correlated_decoding=True, was added to theBUILT_IN_DECODERSdictionary.glue/sample/src/sinter/_decoding/_decoding.py:sample_decodefunction was updated to include 'pymatching-correlated' in the list of available decoders.glue/sample/requirements.txt:packagingas a dependency, as it is used for robust version parsing in the newpymatchingversion check.Testing Adjustments (
glue/sample/src/sinter/_decoding/_decoding_test.py):test_post_selection: This test now explicitly skips the 'pymatching-correlated' decoder. This is because the test circuit contains error probabilities greater than 0.5, which are incompatible with PyMatching's correlated matching (from_detector_error_modelraises an error in this scenario).