This repository provides a collection of Quantum Error Correction (QEC) code implementations using Stim. The goal is to demonstrate how QEC works with different error thresholds and provide practical examples of implementing error correction codes on quantum circuits.
Quantum computers are highly susceptible to errors due to noise and decoherence. Quantum Error Correction (QEC) aims to mitigate these errors and make quantum computers more reliable. In this project, we showcase the implementation of QEC using Stim, a simulator designed for quantum error correction, and Pymatching, a Python library for decoding error syndromes.
This project is designed to provide:
- Examples of QEC implementation: Real-world examples of how quantum error correction codes are used to correct errors in quantum circuits.
- Threshold analysis: Demonstrations of how QEC codes' performance varies with different error thresholds or noise levels.
- Integration with Stim and Pymatching: A practical guide on how to utilize Stim for simulating error correction and Pymatching for decoding.
- Repetition code: A simple example of a 1D repetition code implemented for error correction.
- Surface code (TBA): An implementation of the 2D surface code, one of the most well-known error correction codes in quantum computing.
This package can be installed by cloning the repository and running
pip install .
in the root directory of this repostory. To install in editable mode with the optional dependencies required for development, run
pip install -e ".[dev,docs]"
TBA
To run tests without collecting test coverage data, you can simply use the following command:
pytest
in the root directory of this repostory. If you want a more detailed coverage report in the terminal, you can simply use the following command:
pytest tests --cov --cov-report term-missing
We welcome contributions to this project! To get started, please follow these steps:
Click the Fork button in the top-right corner of the repository page to create a copy of the repository in your GitHub account.
Create a new branch for your changes. This keeps your work separate from the main codebase.
git checkout -b my-feature-branch
Work on your changes locally. Make sure to follow the project’s coding conventions, and keep your changes focused on a single task or issue.
Once you're happy with your changes, commit them with a clear and concise message describing what you’ve done.
git add .
git commit -m "Add feature XYZ"
Before pushing, ensure your fork is up-to-date with the latest changes from the main repository:
git fetch upstream
git rebase upstream/main
Push your changes to your fork on GitHub.
git push origin my-feature-branch
Open a pull request (PR) from your fork’s branch to the main repository. Provide a clear description of what you've done and reference any related issues (e.g., "Fixes #123").
Our maintainers will review your pull request. Be open to feedback and willing to make changes if necessary.
Even after your PR is merged, we encourage you to stay involved and contribute to the project by reporting bugs, submitting more features, or helping with documentation!
-Test your changes: If the project uses tests, ensure they pass before submitting your PR. -Be respectful: Remember, open-source is a community. A positive and collaborative attitude goes a long way.
Thank you for contributing!