Skip to main content

License: MIT CI Python CI Bindings codecov

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

⚠️ This project is still in early development and breaking changes might happen frequently.

(Additionally to the basic numerical results already provided, further data will be published continually)

A tool for quantum error correcting codes and numerical simulations developed by the Chair for Design Automation at the Technical University of Munich based on methods proposed in [1]. QECC is part of the Munich Quantum Toolkit (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, macOS, and Windows.

(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.3.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.3.0
File Size Uploaded Provenance Actions
mqt.qecc-1.3.0.tar.gz 1.8 MB Without provenance Details for mqt.qecc-1.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mqt.qecc 1.3.0
File Actions
mqt.qecc-1.3.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for mqt.qecc-1.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
mqt.qecc-1.3.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.3.0-cp311-cp311-macosx_10_15_x86_64.whl
mqt.qecc-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for mqt.qecc-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
mqt.qecc-1.3.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.3.0-cp310-cp310-macosx_10_15_x86_64.whl
mqt.qecc-1.3.0-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details for mqt.qecc-1.3.0-cp39-cp39-manylinux_2_28_x86_64.whl
mqt.qecc-1.3.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.3.0-cp39-cp39-macosx_10_15_x86_64.whl
mqt.qecc-1.3.0-cp38-cp38-manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.28+ x86-64 Details for mqt.qecc-1.3.0-cp38-cp38-manylinux_2_28_x86_64.whl
mqt.qecc-1.3.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.3.0-cp38-cp38-macosx_10_15_x86_64.whl

Total release size: 92.5 MB

Release files / mqt.qecc-1.3.0.tar.gz

Download URL mqt.qecc-1.3.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
03287b3c9c2444f47abddb76412e639516618b97650f600c125045ae696d34d8
BLAKE2b-256 checksum
How to use checksums
3dfe97d4b4fd00b447316f7f0e9396dc18003ab3de4243ec3140206d8fac8a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL mqt.qecc-1.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 18.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4089f7b0df65edb059f934c5edd8a3d475b974d1fa5476b315d71a84dea1a495
BLAKE2b-256 checksum
How to use checksums
c0fec5d8102b17b451a452460fa18851c33271a256250c4d46c5cd8aeb53a2ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp311-cp311-macosx_10_15_x86_64.whl

Download URL mqt.qecc-1.3.0-cp311-cp311-macosx_10_15_x86_64.whl
Size 4.4 MB
Tags CPython 3.11 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
64ca620db12a7115aceb90698a56993d1b75991c35bc937490bbde097cb5093d
BLAKE2b-256 checksum
How to use checksums
402e4736744d1637c70f8c62e922bb3fba61568fe41e5c7c446826d77da82407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL mqt.qecc-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 18.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
12055a9714d0341b8689e60f5ff58614ec9b6c5c7e539dd2abe262adc1dcad93
BLAKE2b-256 checksum
How to use checksums
f96244f2be9d310bce9ebe7d669882e3b762250257c10d82296d84d684026faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp310-cp310-macosx_10_15_x86_64.whl

Download URL mqt.qecc-1.3.0-cp310-cp310-macosx_10_15_x86_64.whl
Size 4.4 MB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
c28f191bf21278cd7fb49384efce795d5e831f52ecf86251e020e3bf75d7bdc5
BLAKE2b-256 checksum
How to use checksums
bb10d3214319e9398e4a857bb200631a3c9f88535169f1455f75988cc3f072cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL mqt.qecc-1.3.0-cp39-cp39-manylinux_2_28_x86_64.whl
Size 18.2 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
93912bd188ef29d438eb53ea9ff95a4a7f520c02521983ed2faa6a927053ad95
BLAKE2b-256 checksum
How to use checksums
ba25a70022554ce628f7d567d816eebfe3ccbcbc46686f1869dee90f49bfebd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp39-cp39-macosx_10_15_x86_64.whl

Download URL mqt.qecc-1.3.0-cp39-cp39-macosx_10_15_x86_64.whl
Size 4.4 MB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
908cec7b51bc7527501f70aa1517d223cb486c4e7a322b5b491b56e72d3af8b1
BLAKE2b-256 checksum
How to use checksums
fcaf2b7dde70438060650af6c7fd6828d6cdf0146ecfe524aded449e6e16c8bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp38-cp38-manylinux_2_28_x86_64.whl

Download URL mqt.qecc-1.3.0-cp38-cp38-manylinux_2_28_x86_64.whl
Size 18.2 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
46a35e892046bcce6380011aa3f75a74cb0f9a8ec3ed36e9c306b8b41f494eaa
BLAKE2b-256 checksum
How to use checksums
1bbbee914c448796a075c332ba01ca650336258ad0d994b61f617e17c1cbfd47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / mqt.qecc-1.3.0-cp38-cp38-macosx_10_15_x86_64.whl

Download URL mqt.qecc-1.3.0-cp38-cp38-macosx_10_15_x86_64.whl
Size 4.4 MB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
0a274d6d3b850b4e4c49b32842f2a7c3c55b68476176267e0fb901d5ffb1e5a9
BLAKE2b-256 checksum
How to use checksums
0168ec7d7bf5718dd3b4e2d719bc2f1078208705db6fbe87d68eaa0b28aa5cbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

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