Skip to main content

License: MIT CI Python CI Bindings 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.

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)

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

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, L. Burgholzer, P.J. Derks, J. Eisert, and R. Wille, "Decoding quantum color codes with MaxSAT".

  • 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

Metadata

Release files for mqt.qecc 1.5.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.5.0
File Size Uploaded Provenance Actions
mqt_qecc-1.5.0.tar.gz 1.6 MB Without provenance Details for mqt_qecc-1.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mqt.qecc 1.5.0
File Actions
mqt_qecc-1.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for mqt_qecc-1.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.5.0-cp312-abi3-macosx_10_15_x86_64.whl CPython 3.12 abi3 macOS 10.15+ x86-64 Details for mqt_qecc-1.5.0-cp312-abi3-macosx_10_15_x86_64.whl
mqt_qecc-1.5.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.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.5.0-cp311-cp311-macosx_10_15_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.15+ x86-64 Details for mqt_qecc-1.5.0-cp311-cp311-macosx_10_15_x86_64.whl
mqt_qecc-1.5.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.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.5.0-cp310-cp310-macosx_10_15_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.15+ x86-64 Details for mqt_qecc-1.5.0-cp310-cp310-macosx_10_15_x86_64.whl
mqt_qecc-1.5.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.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.5.0-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details for mqt_qecc-1.5.0-cp39-cp39-macosx_10_15_x86_64.whl
mqt_qecc-1.5.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.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
mqt_qecc-1.5.0-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details for mqt_qecc-1.5.0-cp38-cp38-macosx_10_15_x86_64.whl

Total release size: 114.8 MB

Release files / mqt_qecc-1.5.0.tar.gz

Download URL mqt_qecc-1.5.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
4a9b40a4ecc703a89857fe656581ea60cecbeada187030e85394f1f47dd023f2
BLAKE2b-256 checksum
How to use checksums
6dfb40d746de75574906ededa0eafc38a5759db24e57636267f84658855484e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mqt_qecc-1.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 18.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
ac0c4ca9a154dd0affe0dbb819238447fab899a9aa11b0f2120102f3b26277f7
BLAKE2b-256 checksum
How to use checksums
1d3000ee701d9b82dca7ed153dbfa4f6b16cd43c408b436b55a67c7a19335a79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp312-abi3-macosx_10_15_x86_64.whl

Download URL mqt_qecc-1.5.0-cp312-abi3-macosx_10_15_x86_64.whl
Size 4.5 MB
Tags CPython 3.12 abi3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
d0b7b261133113e67be86d42a0f0ecf0caf3445396514e1eb15a8ed8736dbf61
BLAKE2b-256 checksum
How to use checksums
5a6a0c085660adc1b90f1d9e14e9ae39dbd881143f21dff36d80f09257d9eeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

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

Download URL mqt_qecc-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 18.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
50945b4225b413dc7a80541861fce317515d07b9ca4c89d012fc916df10eb6c3
BLAKE2b-256 checksum
How to use checksums
7062395b19b58e5753fcb2e554e22b3aa9fd734562cb536b0bf8327fe9dfea78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp311-cp311-macosx_10_15_x86_64.whl

Download URL mqt_qecc-1.5.0-cp311-cp311-macosx_10_15_x86_64.whl
Size 4.5 MB
Tags CPython 3.11 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
8330029c84d2d7fba857b93e289b203ce120e0d6637163959dc5a0708609c134
BLAKE2b-256 checksum
How to use checksums
c2e2593e391f531318d9687fa296d1210bee9c94b571d5ac424ccb0e79c85d22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

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

Download URL mqt_qecc-1.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 18.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
226cfadd99b983b13141c10a175b21b54009c63c6070cd2da6c8f18aec2044d1
BLAKE2b-256 checksum
How to use checksums
fdd4a8f96da1b8b90faeac3bf56181d0b9e2ec1d6565e729479a2076599aee7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp310-cp310-macosx_10_15_x86_64.whl

Download URL mqt_qecc-1.5.0-cp310-cp310-macosx_10_15_x86_64.whl
Size 4.5 MB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
4e890bd6b0a3e6940264e56650308e0c0b4dd8b40cfa63c9af48b3312b4153a4
BLAKE2b-256 checksum
How to use checksums
8e6d664e0eaf8ed30410ebaf6bde4442ed37c2b8b72185e24ccdf1e9c0be9c5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

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

Download URL mqt_qecc-1.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 18.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
81df09393654c926451cfdd643ec2c0da3fd575ddff678067a913af98e444f1d
BLAKE2b-256 checksum
How to use checksums
bab72c615437437075f7104aeb1663c8cb196caa1fffa6d47ca20fc570153b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp39-cp39-macosx_10_15_x86_64.whl

Download URL mqt_qecc-1.5.0-cp39-cp39-macosx_10_15_x86_64.whl
Size 4.5 MB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
ac6585a8b487b6ae719ad9721d37aa14e0a06e09cced0751513058aeeb7f2d13
BLAKE2b-256 checksum
How to use checksums
f03f71c4b3e0cb641d565ce1cfacd7736bc0f89eaf7f9517a361cd21dbef9688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

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

Download URL mqt_qecc-1.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 18.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1ad89bf1a10fcf83cfe783e86f0817e75963d30c156be9bfb365b2d381bf9b98
BLAKE2b-256 checksum
How to use checksums
af0b06e4c4966cf55bb94c294562a009c315f64b4ccbb753c8246d88e108b73e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / mqt_qecc-1.5.0-cp38-cp38-macosx_10_15_x86_64.whl

Download URL mqt_qecc-1.5.0-cp38-cp38-macosx_10_15_x86_64.whl
Size 4.5 MB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
ded6f2c8ab360f35cc73b5a19e315318a2039d44c8b40144cbe2ac5268d765e5
BLAKE2b-256 checksum
How to use checksums
9418e2684948549589faa6a7e0f9a60f1b25102cbe0ecb7debff46d61c58cd80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

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

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