# qLDPC
This package contains tools for constructing and analyzing [quantum low density parity check (qLDPC) codes](https://errorcorrectionzoo.org/c/qldpc). At least, that was the original motivation for this package. In practice, the tools here can work just as well for more general error-correcting stabilizer and subsystem codes.
## 📦 Installation
This package requires Python>=3.10, and can be installed from the Python Package Index (PyPI) with
```
pip install qldpc
```
To install a local version of qLDPC from source:
```
git clone https://github.com/qLDPCOrg/qLDPC.git
pip install -e qLDPC
```
You can also `pip install -e 'qLDPC[dev]'` to additionally install some development tools.
### macOS
If you use macOS you may need to install `cvxpy` manually by following the instructions [here](https://www.cvxpy.org/install/) before installing `qLDPC`. If you use `conda` to manage your python environment, you can obtain `cvxpy` by running `conda install -c conda-forge cvxpy`.
### GAP
Some features in `qLDPC` require an installation of the computer algebra system [GAP](https://www.gap-system.org/). If you use `conda` to manage your python environment, you can obtain `gap` by running `conda install -c conda-forge gap`.
## 🚀 Features
Notable features include:
- `ClassicalCode`: class for representing classical linear error-correcting codes over finite fields.
- Various pre-defined classical code families.
- Communication with the [GAP](https://www.gap-system.org/)/[GUAVA](https://www.gap-system.org/Packages/guava.html) package for [even more codes](https://docs.gap-system.org/pkg/guava/doc/chap5.html).
- `QuditCode`: class for constructing [Galois-qudit codes](https://errorcorrectionzoo.org/c/galois_into_galois), including both [stabilizer](https://errorcorrectionzoo.org/c/galois_stabilizer) and [subsystem](https://errorcorrectionzoo.org/c/oecc) codes.
- `QuditCode.get_logical_ops`: method to construct a complete basis of nontrivial logical Pauli operators for a `QuditCode`.
- `QuditCode.concatenate`: method to [concatenate](https://errorcorrectionzoo.org/c/quantum_concatenated) `QuditCode`s in various ways.
- `QuditCode.get_distance`: method to compute the code distance (i.e., the minimum weight of a nontrivial logical operator) of a `QuditCode`.
- `CSSCode`: subclass of `QuditCode` for the special case of constructing a [quantum CSS code](https://errorcorrectionzoo.org/c/css) out of two mutually compatible `ClassicalCode`s.
- `CSSCode.get_distance_bound`: method to estimate an upper bound on code distance using the method of [arXiv:2308.07915](https://arxiv.org/abs/2308.07915).
- Classes for special quantum code constructions and code families, such as:
- `TBCode`: [two-block quantum codes](https://errorcorrectionzoo.org/c/two_block_quantum).
- `BBCode`: [bivariate bicycle codes](https://errorcorrectionzoo.org/c/quantum_quasi_cyclic), as in [arXiv:2308.07915](https://arxiv.org/abs/2308.07915) and [arXiv:2311.16980](https://arxiv.org/abs/2311.16980). See [`examples/bivariate_bicycle_codes.ipynb`](https://github.com/qLDPCOrg/qLDPC/blob/main/examples/bivariate_bicycle_codes.ipynb) for methods to identify...
- toric layouts of a `BBCode`, in which the code looks like a toric code augmented by some long-distance checks, as in discussed in [arXiv:2308.07915](https://arxiv.org/abs/2308.07915), and
- qubit layouts that minimize the communication distance for neutral atoms, as discussed in [arXiv:2404.18809](https://arxiv.org/abs/2404.18809).
- `HGPCode`: [hypergraph product codes](https://errorcorrectionzoo.org/c/hypergraph_product).
- `SHPCode`: [subsystem hypergraph product codes](https://errorcorrectionzoo.org/c/subsystem_quantum_parity), as in [arXiv:2002.06257](https://arxiv.org/abs/2002.06257).
- `SHYPSCode`: [subsystem hypergraph product simplex codes](https://errorcorrectionzoo.org/c/shyps), as in [arXiv:2502.07150](https://arxiv.org/abs/2502.07150).
- `LPCode`: [lifted product codes](https://errorcorrectionzoo.org/c/lifted_product), as in [arXiv:2012.04068](https://arxiv.org/abs/2012.04068) and [arXiv:2202.01702](https://arxiv.org/abs/2202.01702).
- `SLPCode`: [subsystem lifted product codes](https://errorcorrectionzoo.org/c/subsystem_lifted_product), as in [arXiv:2404.18302](https://arxiv.org/abs/2404.18302).
- `QTCode`: [quantum Tanner codes](https://errorcorrectionzoo.org/c/quantum_tanner), as in [arXiv:2202.13641](https://arxiv.org/abs/2202.13641) and [arXiv:2206.07571](https://arxiv.org/abs/2206.07571).
- `decoders.py`: module for decoding errors with various methods, including BP-OSD, BP-LSD, and belief-field (via [`ldpc`](https://github.com/quantumgizmos/ldpc)), minimum-weight perfect matching (via [`pymatching`](https://github.com/oscarhiggott/PyMatching)), and others. Includes an interface for using custom decoders.
- `abstract.py`: module for basic abstract algebra (groups, algebras, and representations thereof).
- Various pre-defined groups (mostly borrowed from [SymPy](https://docs.sympy.org/latest/modules/combinatorics/named_groups.html)).
- Communication with the [GAP](https://www.gap-system.org/) computer algebra system and [GroupNames.org](https://people.maths.bris.ac.uk/~matyd/GroupNames/) for constructing [even more groups](https://docs.gap-system.org/doc/ref/chap50.html).
- `objects.py`: module for constructing helper objects such as Cayley complexes and chain complexes, which are instrumental for the construction of various quantum codes.
- `qldpc.circuits.get_transversal_ops`: construction of all SWAP-transversal logical Clifford gates in one code block of a qubit code (see [arXiv:2409.18175](https://arxiv.org/abs/2409.18175); requires [GAP](https://www.gap-system.org/) and [GUAVA](https://www.gap-system.org/Packages/guava.html)). Warning: this method relies on a subroutine (namely, finding classical code automorphisms) that has exponential complexity, and is therefore only practical for codes with small-to-moderate size.
## 🤔 Questions and issues
This project aspires to have a [documentation page](https://qldpc.readthedocs.io/en/latest/), but at the moment the documentation is out of date and auto-generated from source code that was written to be human-readable in a plain text editor. For now, I recommend looking at the source code (and comments therein) directly, as well as the `examples` directory. Test files (such as `qldpc/codes/quantum_test.py`) also contain some examples of using the classes and methods in this library.
If you have any questions, feedback, or requests, please [open an issue on GitHub](https://github.com/qLDPCOrg/qLDPC/issues/new) or email me at [mika.perlin@gmail.com](mailto:mika.perlin@gmail.com)!
## âš“ Attribution
If you use this software in your work, please cite with:
```
@misc{perlin2023qldpc,
author = {Perlin, Michael A.},
title = {{qLDPC}},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/qLDPCOrg/qLDPC}},
}
```
This may require adding `\usepackage{url}` to your LaTeX file header. Alternatively, you can cite
```
Michael A. Perlin. qLDPC. https://github.com/qLDPCOrg/qLDPC, 2023.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/qLDPCOrg/qLDPC",
"name": "qLDPC",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "quantum computing, quantum error correction, low density parity check codes, LDPC",
"author": "Michael A. Perlin",
"author_email": "mika.perlin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d6/bd/93675b705fd3ba579508bea501f626c080f9ab20ca12d82461d90a4a9e86/qldpc-0.1.4.tar.gz",
"platform": null,
"description": "# qLDPC\n\nThis package contains tools for constructing and analyzing [quantum low density parity check (qLDPC) codes](https://errorcorrectionzoo.org/c/qldpc). At least, that was the original motivation for this package. In practice, the tools here can work just as well for more general error-correcting stabilizer and subsystem codes.\n\n## \ud83d\udce6 Installation\n\nThis package requires Python>=3.10, and can be installed from the Python Package Index (PyPI) with\n```\npip install qldpc\n```\n\nTo install a local version of qLDPC from source:\n```\ngit clone https://github.com/qLDPCOrg/qLDPC.git\npip install -e qLDPC\n```\nYou can also `pip install -e 'qLDPC[dev]'` to additionally install some development tools.\n\n### macOS\n\nIf you use macOS you may need to install `cvxpy` manually by following the instructions [here](https://www.cvxpy.org/install/) before installing `qLDPC`. If you use `conda` to manage your python environment, you can obtain `cvxpy` by running `conda install -c conda-forge cvxpy`.\n\n### GAP\n\nSome features in `qLDPC` require an installation of the computer algebra system [GAP](https://www.gap-system.org/). If you use `conda` to manage your python environment, you can obtain `gap` by running `conda install -c conda-forge gap`.\n\n## \ud83d\ude80 Features\n\nNotable features include:\n- `ClassicalCode`: class for representing classical linear error-correcting codes over finite fields.\n - Various pre-defined classical code families.\n - Communication with the [GAP](https://www.gap-system.org/)/[GUAVA](https://www.gap-system.org/Packages/guava.html) package for [even more codes](https://docs.gap-system.org/pkg/guava/doc/chap5.html).\n- `QuditCode`: class for constructing [Galois-qudit codes](https://errorcorrectionzoo.org/c/galois_into_galois), including both [stabilizer](https://errorcorrectionzoo.org/c/galois_stabilizer) and [subsystem](https://errorcorrectionzoo.org/c/oecc) codes.\n - `QuditCode.get_logical_ops`: method to construct a complete basis of nontrivial logical Pauli operators for a `QuditCode`.\n - `QuditCode.concatenate`: method to [concatenate](https://errorcorrectionzoo.org/c/quantum_concatenated) `QuditCode`s in various ways.\n - `QuditCode.get_distance`: method to compute the code distance (i.e., the minimum weight of a nontrivial logical operator) of a `QuditCode`.\n- `CSSCode`: subclass of `QuditCode` for the special case of constructing a [quantum CSS code](https://errorcorrectionzoo.org/c/css) out of two mutually compatible `ClassicalCode`s.\n - `CSSCode.get_distance_bound`: method to estimate an upper bound on code distance using the method of [arXiv:2308.07915](https://arxiv.org/abs/2308.07915).\n- Classes for special quantum code constructions and code families, such as:\n - `TBCode`: [two-block quantum codes](https://errorcorrectionzoo.org/c/two_block_quantum).\n - `BBCode`: [bivariate bicycle codes](https://errorcorrectionzoo.org/c/quantum_quasi_cyclic), as in [arXiv:2308.07915](https://arxiv.org/abs/2308.07915) and [arXiv:2311.16980](https://arxiv.org/abs/2311.16980). See [`examples/bivariate_bicycle_codes.ipynb`](https://github.com/qLDPCOrg/qLDPC/blob/main/examples/bivariate_bicycle_codes.ipynb) for methods to identify...\n - toric layouts of a `BBCode`, in which the code looks like a toric code augmented by some long-distance checks, as in discussed in [arXiv:2308.07915](https://arxiv.org/abs/2308.07915), and\n - qubit layouts that minimize the communication distance for neutral atoms, as discussed in [arXiv:2404.18809](https://arxiv.org/abs/2404.18809).\n - `HGPCode`: [hypergraph product codes](https://errorcorrectionzoo.org/c/hypergraph_product).\n - `SHPCode`: [subsystem hypergraph product codes](https://errorcorrectionzoo.org/c/subsystem_quantum_parity), as in [arXiv:2002.06257](https://arxiv.org/abs/2002.06257).\n - `SHYPSCode`: [subsystem hypergraph product simplex codes](https://errorcorrectionzoo.org/c/shyps), as in [arXiv:2502.07150](https://arxiv.org/abs/2502.07150).\n - `LPCode`: [lifted product codes](https://errorcorrectionzoo.org/c/lifted_product), as in [arXiv:2012.04068](https://arxiv.org/abs/2012.04068) and [arXiv:2202.01702](https://arxiv.org/abs/2202.01702).\n - `SLPCode`: [subsystem lifted product codes](https://errorcorrectionzoo.org/c/subsystem_lifted_product), as in [arXiv:2404.18302](https://arxiv.org/abs/2404.18302).\n - `QTCode`: [quantum Tanner codes](https://errorcorrectionzoo.org/c/quantum_tanner), as in [arXiv:2202.13641](https://arxiv.org/abs/2202.13641) and [arXiv:2206.07571](https://arxiv.org/abs/2206.07571).\n- `decoders.py`: module for decoding errors with various methods, including BP-OSD, BP-LSD, and belief-field (via [`ldpc`](https://github.com/quantumgizmos/ldpc)), minimum-weight perfect matching (via [`pymatching`](https://github.com/oscarhiggott/PyMatching)), and others. Includes an interface for using custom decoders. \n- `abstract.py`: module for basic abstract algebra (groups, algebras, and representations thereof).\n - Various pre-defined groups (mostly borrowed from [SymPy](https://docs.sympy.org/latest/modules/combinatorics/named_groups.html)).\n - Communication with the [GAP](https://www.gap-system.org/) computer algebra system and [GroupNames.org](https://people.maths.bris.ac.uk/~matyd/GroupNames/) for constructing [even more groups](https://docs.gap-system.org/doc/ref/chap50.html).\n- `objects.py`: module for constructing helper objects such as Cayley complexes and chain complexes, which are instrumental for the construction of various quantum codes.\n- `qldpc.circuits.get_transversal_ops`: construction of all SWAP-transversal logical Clifford gates in one code block of a qubit code (see [arXiv:2409.18175](https://arxiv.org/abs/2409.18175); requires [GAP](https://www.gap-system.org/) and [GUAVA](https://www.gap-system.org/Packages/guava.html)). Warning: this method relies on a subroutine (namely, finding classical code automorphisms) that has exponential complexity, and is therefore only practical for codes with small-to-moderate size.\n\n## \ud83e\udd14 Questions and issues\n\nThis project aspires to have a [documentation page](https://qldpc.readthedocs.io/en/latest/), but at the moment the documentation is out of date and auto-generated from source code that was written to be human-readable in a plain text editor. For now, I recommend looking at the source code (and comments therein) directly, as well as the `examples` directory. Test files (such as `qldpc/codes/quantum_test.py`) also contain some examples of using the classes and methods in this library.\n\nIf you have any questions, feedback, or requests, please [open an issue on GitHub](https://github.com/qLDPCOrg/qLDPC/issues/new) or email me at [mika.perlin@gmail.com](mailto:mika.perlin@gmail.com)!\n\n## \u2693 Attribution\n\nIf you use this software in your work, please cite with:\n```\n@misc{perlin2023qldpc,\n author = {Perlin, Michael A.},\n title = {{qLDPC}},\n year = {2023},\n publisher = {GitHub},\n journal = {GitHub repository},\n howpublished = {\\url{https://github.com/qLDPCOrg/qLDPC}},\n}\n```\nThis may require adding `\\usepackage{url}` to your LaTeX file header. Alternatively, you can cite\n```\nMichael A. Perlin. qLDPC. https://github.com/qLDPCOrg/qLDPC, 2023.\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Tools for constructing and analyzing quantum low density parity check (qLDPC) codes.",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/qLDPCOrg/qLDPC",
"Repository": "https://github.com/qLDPCOrg/qLDPC"
},
"split_keywords": [
"quantum computing",
" quantum error correction",
" low density parity check codes",
" ldpc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f89e6ab0a63cb7b95b78d2d3759da5a4b0ab22449d65b4ab6e1de8c58f1c6367",
"md5": "122d1448290d1188a83edd94a556a35a",
"sha256": "2fc6b8ebb17d67d532ef9c5912e497837e27259c34c37d6697c88936592e01e1"
},
"downloads": -1,
"filename": "qldpc-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "122d1448290d1188a83edd94a556a35a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 134951,
"upload_time": "2025-07-31T17:45:29",
"upload_time_iso_8601": "2025-07-31T17:45:29.489945Z",
"url": "https://files.pythonhosted.org/packages/f8/9e/6ab0a63cb7b95b78d2d3759da5a4b0ab22449d65b4ab6e1de8c58f1c6367/qldpc-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d6bd93675b705fd3ba579508bea501f626c080f9ab20ca12d82461d90a4a9e86",
"md5": "7d0595f59e5a886d01a343f46fd4c3ad",
"sha256": "f0354757998bf44195ae98de5d8329a7ef09548264e3a568a5d5f3cd93d25242"
},
"downloads": -1,
"filename": "qldpc-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "7d0595f59e5a886d01a343f46fd4c3ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 116910,
"upload_time": "2025-07-31T17:45:30",
"upload_time_iso_8601": "2025-07-31T17:45:30.812957Z",
"url": "https://files.pythonhosted.org/packages/d6/bd/93675b705fd3ba579508bea501f626c080f9ab20ca12d82461d90a4a9e86/qldpc-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-31 17:45:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "qLDPCOrg",
"github_project": "qLDPC",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "qldpc"
}