Skip to main content

PyPI OS License: MIT CI CD Documentation codecov

MQT QECC: A tool for Quantum Error Correcting Codes written in C++

A tool for quantum error correcting codes and numerical simulations developed as part of the Munich Quantum Toolkit (MQT) by the Chair for Design Automation at the Technical University of Munich. It builds upon MQT Core, which forms the backbone of the MQT.

The tool can be used to:

  • Decode quantum LDPC codes and conduct respective numerical simulations.
    • At the moment the general QLDPC decoder [2] and a heuristic (which improves the runtime of the algorithm) [1] are implemented. Currently, open-source software by Joschka Roffe et al.: [3] is used to construct codes (toric, lifted product and hypergraph product).
  • Decode (triangular) color codes and conduct respective numerical simulations.
    • The decoder is based on an analogy to the classical LightsOut puzzle and formulated as a MaxSAT problem. The SMT solver Z3 is used to determine minimal solutions of the MaxSAT problem, resulting in minimum-weight decoding estimates.
  • Apply error correction to quantum circuits.
    • The framework allows to apply different QECC schemes to quantum circuits and either exports the resulting circuits or simulates them using Qiskit [4]. Currently, six different ECCs are supported with varying extent of functionality.
  • WIP: Decode bosonic quantum LDPC codes and conduct numerical simulations for analog information decoding under phenomenological (cat qubit) noise.

Documentation

If you have any questions, feel free to contact us via quantum.cda@xcit.tum.de or by creating an issue on GitHub.

Getting Started

QECC is available via PyPI for Linux and macOS and supports Python 3.8 to 3.12.

(venv) $ pip install mqt.qecc

The following code gives an example on the usage:

Example for decoding quantum LDPC codes

from mqt.qecc import *
import numpy as np

H = [[1, 0, 0, 1, 0, 1, 1], [0, 1, 0, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1]]
code = Code(H, H)
decoder = UFHeuristic()
decoder.set_code(code)
x_err = sample_iid_pauli_err(code.N, 0.05)
decoder.decode(code.get_x_syndrome(x_err))
result = decoder.result
print(result)
residual_err = np.array(x_err) ^ np.array(result.estimate)
print(code.is_x_stabilizer(residual_err))

Example for decoding color codes

Simply running the following code will perform a numerical analysis of the MaxSAT color code decoder for an instance of the distance-21 triangular color code with a bit-flip error rate of 0.01 and 1000 simulations.

from mqt.qecc.cc_decoder import decoder

d = 21  # distance of the triangular code to simulate
p = 0.01  # (bit-flip) error rate
nr_sims = 1000  # number of simulations to run
decoder.run(distance=d, error_rate=p, nr_sims=nr_sims)

Example for applying error correction to a circuit

from mqt import qecc

file = "path/to/qasm/file.qasm"  # Path to the OpenQASM file the quantum circuit shall be loaded from
ecc = "Q7Steane"  # Error correction code that shall be applied to the quantum circuit
ecc_frequency = 100  # After how many times a qubit is used, error correction is applied

result = qecc.apply_ecc(file, ecc, ecc_frequency)

# print the resulting circuit as OpenQASM string
print(result["circ"])

A wrapper script for applying error correction to quantum circuits (provided as OpenQASM) and performing a noise-aware quantum circuit simulation (using Qiskit) is provided. The script can be used like this:

$ (venv) ecc_qiskit_wrapper -ecc Q7Steane -fq 100 -m D -p 0.0001 -n 2000 -fs aer_simulator_stabilizer -s 0 -f  ent_simple1000_n2.qasm
_____Trying to simulate with D (prob=0.0001, shots=2000, n_qubits=17, error correction=Q7Steane) Error______
State |00> probability 0.515
State |01> probability 0.0055
State |10> probability 0.0025
State |11> probability 0.477

Detailed documentation on all available methods, options, and input formats is available at ReadTheDocs.

System Requirements and Building

The implementation is compatible with any C++17 compiler and a minimum CMake version of 3.19. Please refer to the documentation on how to build the project.

Building (and running) is continuously tested under Linux and macOS using the latest available system versions for GitHub Actions. Windows support is currently experimental.

Reference

If you use our tool for your research, we will be thankful if you refer to it by citing the appropriate publication:

  • a L. Berent, T. Hillmann, J. Eisert, R. Wille, and J. Roffe, "Analog information decoding of bosonic quantum LDPC codes".

  • a L. Berent, L. Burgholzer, P.J. Derks, J. Eisert, and R. Wille, "Decoding quantum color codes with MaxSAT".

    The dataset used in the paper evaluation on decoding quantum color codes is available on Zenodo: a

  • a T. Grurl, C. Pichler, J. Fuss and R. Wille, "Automatic Implementation and Evaluation of Error-Correcting Codes for Quantum Computing: An Open-Source Framework for Quantum Error-Correction," in International Conference on VLSI Design and International Conference on Embedded Systems (VLSID), 2023

  • a L. Berent, L. Burgholzer, and R. Wille, "Software Tools for Decoding Quantum Low-Density Parity Check Codes," in Asia and South Pacific Design Automation Conference (ASP-DAC), 2023

Credits

The contributors to this tool are:

  • Lucas Berent
  • Lukas Burgholzer
  • Thomas Grurl
  • Peter-Jan H.S. Derks
  • Timo Hillmann

Acknowledgements

The Munich Quantum Toolkit has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (grant agreement No. 101001318), the Bavarian State Ministry for Science and Arts through the Distinguished Professorship Program, as well as the Munich Quantum Valley, which is supported by the Bavarian state government with funds from the Hightech Agenda Bayern Plus.

TUM Logo Coat of Arms of Bavaria ERC Logo MQV Logo

Metadata

Release files for mqt.qecc 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mqt.qecc 1.7.0
File Size Uploaded Provenance Actions
mqt_qecc-1.7.0.tar.gz 526.0 kB Without provenance Details for mqt_qecc-1.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mqt.qecc 1.7.0
File Actions
mqt_qecc-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 11.0+ x86-64 Details for mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_x86_64.whl
mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_arm64.whl
mqt_qecc-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_x86_64.whl CPython 3.11 CPython 3.11 macOS 11.0+ x86-64 Details for mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_x86_64.whl
mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_arm64.whl
mqt_qecc-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 11.0+ x86-64 Details for mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_x86_64.whl
mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_arm64.whl
mqt_qecc-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_x86_64.whl CPython 3.9 CPython 3.9 macOS 11.0+ x86-64 Details for mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_x86_64.whl
mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_arm64.whl
mqt_qecc-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_x86_64.whl CPython 3.8 CPython 3.8 macOS 11.0+ x86-64 Details for mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_x86_64.whl
mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_arm64.whl CPython 3.8 CPython 3.8 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_arm64.whl

Total release size: 16.6 MB

Release files / mqt_qecc-1.7.0.tar.gz

Download URL mqt_qecc-1.7.0.tar.gz
Size 526.0 kB
Tags Source
SHA-256 checksum
How to use checksums
555d333cb46996d5a49ceab49dce89f5fed452b16b1af3a4ae43b7f218339660
BLAKE2b-256 checksum
How to use checksums
bb60beefeb00712dd519a1725a357f2e2ae32b4217fce8f202539a68616a6b20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
449c8a50b4a9895e2b29b731fd490aece891c2c1f310658d7e23a72a58b7e803
BLAKE2b-256 checksum
How to use checksums
2fcf49028f7b6956bb06cf1ecc0b8fb0fb811714913de8494f72c3c02176c903
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_x86_64.whl
Size 1.0 MB
Tags CPython 3.12 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
1d1c0670ceb4e416aa0daa66e349ac0bab3c2ed5cece1d994dff44866f9ba100
BLAKE2b-256 checksum
How to use checksums
2f5c0aca626dce73f0c65a48c82e8ab5d781fc9e6958f8bac5084ca51dcc028c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.0-cp312-cp312-macosx_11_0_arm64.whl
Size 1.0 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
858c28921927df6d4d4ad7ff0cfea59bcbb07348c5b1a10ea44d85959d47c0cf
BLAKE2b-256 checksum
How to use checksums
e38ef7cc439500ac209bd391107bfbddb02c6438dbf2987ca20d46cbd4949851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2c0ee8cdda3f9ab52e1fa4f7d9afc7c159b3070ac16a788f5458015dacb34740
BLAKE2b-256 checksum
How to use checksums
5e6d89e641865496fd69f0f3962efc282c932e4aa1b4abfb9bd15b0f783942c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_x86_64.whl
Size 1.0 MB
Tags CPython 3.11 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
6b7d350c2d90637df1d991ba16723c10d9d241f1fa970c317444b079fcc95c94
BLAKE2b-256 checksum
How to use checksums
dc6485fa22b79ca9aeb1fef4f17c1c1430d1223f39040e69269073b6cdf20e35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.0-cp311-cp311-macosx_11_0_arm64.whl
Size 989.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3bc001db5d555e8198fb333a2430acdf6a2d871f34ed84bf34f40bf889a93d84
BLAKE2b-256 checksum
How to use checksums
71dc5a206e26e8488ca1bdfccde95bb46a60f309a1d1857bcd852de7be35d8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7c3212cb08391f2ebc24c5393f2c90c2835da11c25f88a611b29bf828e5e4afb
BLAKE2b-256 checksum
How to use checksums
cd6dc2da7f7f28a963e1c64bccddda684999bf53952c2beaabdf198b3e19063d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_x86_64.whl
Size 1.0 MB
Tags CPython 3.10 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
c56e7ec53cb48cca474b2ef62e169c258be74c460d7e13cae63697456fc57506
BLAKE2b-256 checksum
How to use checksums
85dd74a2510a1b2ea625ffec197353834c98f9dbda2e001b29fe8d4991fd23f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.0-cp310-cp310-macosx_11_0_arm64.whl
Size 988.4 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5a385f87cbb4de892fdebda236eabd0935ad28a45e9bcfb15f8c698d4949132b
BLAKE2b-256 checksum
How to use checksums
77b8123b41a59f22125006f065d2448d632b2d195cfff502b2bc4a36e71c2e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9a66efa7f48ad5118105d878333c6dad6f9921f956670a1e3ba99c5d6013e006
BLAKE2b-256 checksum
How to use checksums
e062f859defcbe4094db16cbbad9fa598915c5c4e9d6bbd6394783aa4393f007
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_x86_64.whl
Size 1.0 MB
Tags CPython 3.9 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
f1b826ac2daa75db252ee7d5654b9d04551bc35154b75c00473e0096cb9d842f
BLAKE2b-256 checksum
How to use checksums
2960ab8e96469ab430866116d1dc5b351bf5d769f6c0e31ccf1ad3700bf66f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.0-cp39-cp39-macosx_11_0_arm64.whl
Size 988.7 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9f529c6224fec20b4169b5610c463267a6f41baace3a4936ac2ed13f9bdc7ff9
BLAKE2b-256 checksum
How to use checksums
60b8f4ad9466372fb4d5a8dd46db78771ae7d835d523593cbfc529e4ba2f8814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
341e554ef1acb0592c75ae18dc631ec86d1a312d58e6fe3dd39ccf886a60d630
BLAKE2b-256 checksum
How to use checksums
2ad519bf4fa75936f6fcd4777de38ada6fff56952f8e9fbdbc7765cf89ff216e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_x86_64.whl
Size 1.0 MB
Tags CPython 3.8 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
f496f287dbb2549688ce2034f2de834b41ed642ed6d9788d14bac7576f89ddfe
BLAKE2b-256 checksum
How to use checksums
982914edd1e6e487a47434daa49f005f5c3138449a8571ab328e2cff7d5ee25d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.0-cp38-cp38-macosx_11_0_arm64.whl
Size 988.4 kB
Tags CPython 3.8 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
03fb65e16ab6399fc33add702ca9396834a693c6a999c19bdcdb419461f079a0
BLAKE2b-256 checksum
How to use checksums
7722265e726d8c67e8f119c848e553451892fc22777449e714e341fa150632cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Security for mqt.qecc 1.7.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page