qLDPC
This library contains tools for constructing and analyzing quantum low density parity check (qLDPC) codes. At least, that was the original motivation for this library. In practice, the tools here work just as well for error-correcting stabilizer and subsystem codes more broadly.
In a nutshell, qLDPC provides supports a variety of built-in codes and custom codes constructed from parity check matrices that represent stabilizer or gauge group generators. Once a code is constructed, qLDPC automates various tasks of common interest, and integrates with external tools for analyzing error-correcting codes (including QDistRnd, ldpc, stim, and sinter, among others). Automated tasks include:
- constructing a canonical basis logical Pauli operators,
- computing (or upper-bounding) code distance,
- computing logical error rates in a code-capacity model,
- constructing various circuits of interest, such as a quantum memory experiment for obtaining circuit-level logical error rates,
- defining custom Pauli noise models,
- plugging a decoder of choice into your workflow.
Where possible, this library strives to support qudit codes over arbitrary finite (Galois) fields, although circuit-related utilities are (at least currently) limited to qubit codes. See the examples directory for some demonstrations and use-cases.
📦 Installation
This library 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.
GAP
Some features in qLDPC require an installation of the GAP computer algebra system. If you (a) use linux or macOS, and (b) use a conda to manage your python environment, then you can obtain GAP by running conda install -c conda-forge gap (or gap-core). Installations without conda should also work, as long as gap is a recognized command in the command line. Unfortunately, I have not figured out how to install GAP in a qLDPC-compatible way on Windows. If you figure this out, please let me know!
macOS
If you use macOS you may need to install cvxpy manually by following the instructions here before installing qLDPC. If you use conda to manage your python environment, you can obtain cvxpy by running conda install -c conda-forge cvxpy.
🚀 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/
GUAVApackage for even more codes.
QuditCode: class for constructing Galois-qudit codes, including both stabilizer and subsystem codes.QuditCode.get_logical_ops: method to construct a complete basis of nontrivial logical Pauli operators for aQuditCode.QuditCode.get_distance: method to compute the exact code distance of aQuditCode(i.e., the minimum weight of a nontrivial logical operator). Includes options to compute an upper bound on code distance usingQDistRndor (for CSS codes) a decoder-based method introduced in arXiv:2308.07915.QuditCode.concatenate: method to concatenateQuditCodes in various ways.
CSSCode: subclass ofQuditCodefor the special case of constructing a quantum CSS code out of two mutually compatibleClassicalCodes. Special cases (subclasses) with specialized constructors and helper methods include:TBCode: two-block quantum codes.BBCode: bivariate bicycle codes, as in arXiv:2308.07915 and arXiv:2311.16980. Seeexamples/bivariate_bicycle_codes.ipynbfor 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, and - qubit layouts that minimize the communication distance for neutral atoms, as discussed in arXiv:2404.18809.
- toric layouts of a
HGPCode: hypergraph product codes, first introduced in arXiv:0903.0566.SHPCode: subsystem hypergraph product codes, as in arXiv:2002.06257.SHYPSCode: subsystem hypergraph product simplex codes, as in arXiv:2502.07150.LPCode: lifted product codes, as in arXiv:2012.04068 and arXiv:2202.01702.SLPCode: subsystem lifted product codes, as in arXiv:2404.18302.QTCode: quantum Tanner codes, as in arXiv:2202.13641 and arXiv:2206.07571.
decoders.py: module for decoding errors with various methods, including BP-OSD, BP-LSD, and belief-find (vialdpc), Relay-BP (viarelay-bp), minimum-weight perfect matching (viapymatching), and others. Includes an interface for using custom decoders.qldpc.circuits: module forstimcircuits and circuit utilities, including:get_memory_experiment: circuit for testing the performance of a code as a quantum memory. Accepts both predefined and custom-builtSyndromeMeasurementStrategys.NoiseModel: class for constructing expressive Pauli noise models, which map noiseless circuits to noisy circuits. Built-in subclasses include a single-parameterDepolarizingNoiseModeland a superconducting-inspiredSI1000NoiseModel.SinterDecoder: class to construct circuit-level decoders that are usable bysinter.get_encoding_circuit: circuit to prepare the all-|0> logical state of a code. (Warning: generally not fault-tolerant. Fault-tolerant encoding circuits pending.)get_transversal_ops: logical tableaus and physical circuits for the SWAP-transversal logical Clifford gates of a code, constructed via the code automorphism method of arXiv:2409.18175. (Warning: exponential complexity.)get_transversal_circuits: find a SWAP-transversal physical circuit (if any) that implements a given logical Clifford operation in a code. (Warning: exponential complexity.)
abstract.py: module for abstract algebra (groups, algebras, modules, and representations thereof).- Various pre-defined groups (mostly borrowed from SymPy).
- Communication with the GAP computer algebra system and GroupNames.org for constructing even more groups.
objects.py: module for constructing helper objects such as Cayley complexes and chain complexes, which are instrumental for the construction of various quantum codes.
🤔 Questions and issues
This project aspires to have a documentation page, 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 or email me at 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qldpc-0.2.0.tar.gz.
File metadata
- Download URL: qldpc-0.2.0.tar.gz
- Upload date:
- Size: 140.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.1.3 CPython/3.13.1 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbd4b5ee532d19ae0c3f1613edf6113bc692795cb2e21e8eea4f8d4dfd06bb8
|
|
| MD5 |
3303b424f500abfdbc93b383c81fbfbd
|
|
| BLAKE2b-256 |
3533c1132087f04d1ad3674e2f29e1f1b280f510809d1ab1d97b029ff0ab6b7f
|
File details
Details for the file qldpc-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qldpc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 169.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.1.3 CPython/3.13.1 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a57163ba032c79981f32aa588162e8aca177a43de15cea853851519f63a3e014
|
|
| MD5 |
29a21988cf413b33032cae595ce0ee0e
|
|
| BLAKE2b-256 |
c081fc6cd4e6a6e37f5a225cee6abe0b0f17cc0517b57169b3f3232d06c4da32
|