qLDPC
qLDPC is a Python toolkit for constructing and analyzing finite-size quantum low-density parity-check codes, as well as stabilizer and subsystem codes more broadly.
It provides shared implementations and scientific conventions that researchers and their AI assistants can inspect, combine, and extend.
Most code-level tools work over arbitrary finite fields. Circuit tools currently only support binary codes.
🎯 Goals
- Enable exploration. Favor small, composable tools and extension points that let users quickly investigate and prototype new ideas.
- Make scientific meaning explicit. Expose conventions, assumptions, and limitations, and distinguish exact results, bounds, estimates, and trusted inputs.
- Support checking and reproduction. Provide independent evidence for maintained behavior and make the configuration needed to interpret and reproduce experiments clear.
- Support learning. Use small examples and explanations to connect computations to ideas, literature, and implementations.
✨ A few things to try
- Code families. Construct surface, toric, hypergraph-product, lifted-product, bivariate-bicycle, quantum Tanner, and many other code families, as well as classical codes such as Hamming and Reed-Muller codes.
- Distance calculations.
Compute exact distances of binary codes with an optimized Brouwer-Zimmermann search or a connected-cluster search, which can be much faster on quantum codes with sparse checks.
Bound code distance using QDistRnd or
sqetch. - Code structure and analysis. Work with check matrices, Tanner graphs, canonical logical operators, subsystem gauge operators, and code-capacity error estimates.
- Circuits and decoding workflows. Build memory experiments, encoding circuits, noise models, and state-preparation diagnostics; decode with Sinter or sliding-window decoders; compute exact fault distances and certify bounded fault propagation; or search for transversal Clifford gates.
- Algebraic tools. Work with finite groups, rings, and chain complexes, with optional GAP integration.
The example notebooks cover (among other things) code construction, custom noise models, circuit-level logical error rates, and fault-tolerance certificates.
🚀 Quickstart
from sympy.abc import x, y
from qldpc import codes
# the [[144, 12, 12]] bivariate bicycle "gross code", also built by codes.GrossCode()
code = codes.BBCode({x: 12, y: 6}, x**3 + y + y**2, y**3 + x + x**2)
print(code)
print("physical qubits:", len(code))
print("logical qubits:", code.dimension)
A subsystem lifted-product code
This example builds a subsystem lifted-product code from a matrix over the group algebra GF(2)[C₅].
from qldpc import abstract, codes
group = abstract.CyclicGroup(5)
ring = abstract.GroupRing(group)
x = ring.generators[0]
repetition = abstract.RingArray.build(
[[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1]],
ring,
)
connections = abstract.RingArray.build(
[[0, x, 0, 0], [0, 0, x, 0], [0, 0, 0, x]],
ring,
)
code = codes.SLPCode(repetition + connections)
print("physical qubits:", len(code)) # 80
print("logical qubits:", code.dimension) # 5
print("gauge qubits:", code.gauge_dimension) # 45
📦 Installation
qLDPC requires Python 3.11 or later:
python -m pip install qldpc
The standard installation includes the ldpc and pymatching decoders.
See the installation guide for optional decoders, GAP integration, matrix automorphisms, and GPU distance estimation with sqetch.
For a development checkout, follow the development installation instructions.
🧭 Find your way around
| Goal | Start here |
|---|---|
| See what each package does and how the packages fit together | Library map |
| Learn the concepts through runnable examples | Examples |
| Browse code families, functions, and exact signatures | API reference |
| Construct and analyze a code | qLDPC basics |
| Estimate logical error rates | Logical-error-rate examples |
| Build memory circuits or noise models | Circuit examples |
| Change or extend qLDPC safely | Contributing guide |
⚠️ Limitations and caveats
qLDPC is research software.
- Circuits returned by
get_encoding_circuitare not fault-tolerant. Fault-tolerant encoding is tracked in issue #327. - Exact distance calculations, fault-tolerance certificates, and transversal-gate searches can take exponential time.
To keep each exact distance search or certification on one thread when many run at once, see
help(qldpc)(the reference ofqldpc); to choose a method when a search is slow, seeqldpc.codes.distance.DistanceMethod. - Features that use GAP may run GAP as a separate process, access the network, copy text to the clipboard, or ask on standard input, such as before installing a GAP package.
- Code lookups such as
QuditCode.from_qecdb_idaccess online resources and cache results on disk; passrefresh=Trueto fetch the latest data. - Everything under
qldpc.experimentalhas an unstable public API and may change without deprecation, so pin the qLDPC version if you depend on it. Lattice-surgery support inqldpc.experimental.surgerystill awaits expert review, so validate its results independently.
📚 Documentation and support
Questions, feedback, and ideas are welcome through GitHub issues or by email at mika.perlin@gmail.com.
AI usage
AI assistants are used in qLDPC's development and maintenance. Human maintainers direct and approve changes, but may rely on AI-assisted review and automated checks rather than reviewing every implementation detail. AI-assisted contributions are held to the same standards for scientific correctness, testing, documentation, and compatibility as other contributions. Project maintainers remain responsible for accepting contributions and communicating their assumptions and limitations.
⚓ Attribution
If you use qLDPC in your work, please cite it as CITATION.cff describes.
qLDPC is distributed under the Apache License 2.0.
Metadata
Release files for qldpc 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qldpc-0.5.0.tar.gz | 1.5 MB | Without provenance | Details for qldpc-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qldpc-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for qldpc-0.5.0-py3-none-any.whl |
Total release size: 3.3 MB
Release files / qldpc-0.5.0.tar.gz
| Download URL | qldpc-0.5.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24c1a850b22ee7c01786d9a7e1bceae2306707bd15abf29772aa3626e9563859
|
|
BLAKE2b-256 checksum How to use checksums |
90d6e89732e986aa9c4d32d10f021a0201b62c812621949cccb81625539a378a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / qldpc-0.5.0-py3-none-any.whl
| Download URL | qldpc-0.5.0-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
244f8d5c822f3688fbeec4b447332cc651ce8c6c8de153aa51fe96c63263d727
|
|
BLAKE2b-256 checksum How to use checksums |
427a9f3398d6037ec209124132372a97a524a2a9f1e4748205da7a9c89e83225
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Security for qldpc 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.