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.1

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.1
File Size Uploaded Provenance Actions
mqt_qecc-1.7.1.tar.gz 526.1 kB Without provenance Details for mqt_qecc-1.7.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mqt.qecc 1.7.1
File Actions
mqt_qecc-1.7.1-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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.1-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.1-cp312-cp312-macosx_11_0_x86_64.whl
mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_arm64.whl
mqt_qecc-1.7.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.1-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.1-cp311-cp311-macosx_11_0_x86_64.whl
mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl
mqt_qecc-1.7.1-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.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.1-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.1-cp310-cp310-macosx_11_0_x86_64.whl
mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl
mqt_qecc-1.7.1-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.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.1-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.1-cp39-cp39-macosx_11_0_x86_64.whl
mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl
mqt_qecc-1.7.1-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.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.7.1-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.1-cp38-cp38-macosx_11_0_x86_64.whl
mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl CPython 3.8 CPython 3.8 macOS 11.0+ ARM64 Details for mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl

Total release size: 16.6 MB

Release files / mqt_qecc-1.7.1.tar.gz

Download URL mqt_qecc-1.7.1.tar.gz
Size 526.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8fca332be0c1a110b399e5750b639c8bd2f473a79dee66777efafa487989aa6b
BLAKE2b-256 checksum
How to use checksums
7b53ca215086b7525287083c09b5aa761f9cc8044e8893812af2f5395d35fbb6
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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.1-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
8aadada24a389189bfb0400b1bf5d1b4ab8bedec612bbfcac2a3a7d61c0c6ced
BLAKE2b-256 checksum
How to use checksums
46fe1dcfe681300ada89dd474bcb2c867b2712298103bfb0673a51cc70cab7ed
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.1-cp312-cp312-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.1-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
b1c014b3d0a160b201debddf5ba6e7f1526ec13040c66264ba984e57878763cf
BLAKE2b-256 checksum
How to use checksums
0b833f7ebda59729b20fe27b5c0e85a715bbc90d92680e69e9c31bd79b7182e8
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.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.1-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
2f143419397af3f91e346c5c59764e3515a105bf458a3c8bcad501b850c20a39
BLAKE2b-256 checksum
How to use checksums
d284eb017dc2146303620ab6ae0ab10ace66f922275fe7e5f6ce9018087199e5
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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.1-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
eb6130f7e2549cbb2441c5ad8d2a6f2086c28041c1cc9585ebf1661d50c80ef1
BLAKE2b-256 checksum
How to use checksums
5e78b524fde824d3b02f5926e21e45dbc9d0dc22c0da2582f5e1fceb99a0b203
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.1-cp311-cp311-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.1-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
00925c2f9266809db6788c618c0188ea99663a8cb28e5150158640a180e39bb9
BLAKE2b-256 checksum
How to use checksums
fe0840ba5566a799b02046a2fb74918cdca2897531f5556551167071fc338429
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.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl
Size 989.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
16f733b864f46f6cee0091b3e33d6e51d55280b83c4b52c335ca42c290f49b22
BLAKE2b-256 checksum
How to use checksums
5f3c25782caa5a8111470c88f651d5132a8441a255c2394b53f5d4eadffa2669
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.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.1-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
eacf2cc6c462afba3d495fb28777a8d981b97463b4a8bcba43a9490184d06b67
BLAKE2b-256 checksum
How to use checksums
703b221962c59e4fb4abaf6ae72c682ceb42f996c97eb6f8755b31d17c2a70cd
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.1-cp310-cp310-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.1-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
f20eec10d43259506cf4917eec2c495af3ee7c4940c8cf3f432f62151c4bfba2
BLAKE2b-256 checksum
How to use checksums
7a76c346ca584e86781bbc492018c2fc785d840333015c8c4d8a687ca72b8416
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.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl
Size 988.3 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2fdede94e1c7d04ea6e36c468a96d11a920004b887e3fe7cad813f49132ac746
BLAKE2b-256 checksum
How to use checksums
d603f17329004fefa218772f0691d822ef940c291737b732e8ec28fa6cdab944
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.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.1-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
55c9893e1ef73e14642d281ba1ba755b4026bb4973ea2a46c3f4b6b3ab36470e
BLAKE2b-256 checksum
How to use checksums
de57ca0bb511edd0be7929337290ebc3763028fe3e187f9e5c8e012a394281bd
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.1-cp39-cp39-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.1-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
d940895de7ef3f107cd8d3d5821de0a1530aacebadc4f701524f05b9da5552eb
BLAKE2b-256 checksum
How to use checksums
a8c4b4f2323c6fbc1cbd45ac3c8fd79dcacff451601bc203d430621d1357cc5d
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.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl
Size 988.5 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
04324f6099ef3a0c74ec008a002a284cc8cd866f259e811347b68a4c7a73661b
BLAKE2b-256 checksum
How to use checksums
97cb5013849657b68b97f222d9e445cccb14578385b5c0b58e48048c883ef8b7
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.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.7.1-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
e5b243e84027f07d322e969f1e5c8bdd4787e6649c2b74ff661a5d5d11c9c4a5
BLAKE2b-256 checksum
How to use checksums
8eb222461d24963c3915b26868bdd1bcb575af53db73a0d4f30ff7e78a96c4e3
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.1-cp38-cp38-macosx_11_0_x86_64.whl

Download URL mqt_qecc-1.7.1-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
28de38f475c11f063cd3c556c9b9ba3c32e993bdacbb8b3abe1574cf541fedac
BLAKE2b-256 checksum
How to use checksums
574cd0cd7386d6474de2cc04c04f05bcf8347a0bb8b1308fbea80a82d8e2e0ba
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.1-cp38-cp38-macosx_11_0_arm64.whl

Download URL mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl
Size 988.2 kB
Tags CPython 3.8 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4743d12bc15b29e59f2dbd13f9b928b29686681ed4ac03afcf2de2c89931eab9
BLAKE2b-256 checksum
How to use checksums
5af942f504629cc4bb019294b5bb9636583b53b7752ecf49ac8fa76e8d3e2154
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.1

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