Skip to main content

QECC - An MQT Tool for Quantum Error Correcting Codes

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mqt_qecc-1.7.1.tar.gz (526.1 kB view details)

Uploaded Source

Built Distributions

mqt_qecc-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

mqt_qecc-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl (989.4 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mqt_qecc-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl (988.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mqt_qecc-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl (988.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mqt_qecc-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl (988.2 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

Details for the file mqt_qecc-1.7.1.tar.gz.

File metadata

  • Download URL: mqt_qecc-1.7.1.tar.gz
  • Upload date:
  • Size: 526.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for mqt_qecc-1.7.1.tar.gz
Algorithm Hash digest
SHA256 8fca332be0c1a110b399e5750b639c8bd2f473a79dee66777efafa487989aa6b
MD5 155e6618ae1e8d5c45db807a0a6ad996
BLAKE2b-256 7b53ca215086b7525287083c09b5aa761f9cc8044e8893812af2f5395d35fbb6

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8aadada24a389189bfb0400b1bf5d1b4ab8bedec612bbfcac2a3a7d61c0c6ced
MD5 87163e8eec3dcbe4be2f1866de4ca493
BLAKE2b-256 46fe1dcfe681300ada89dd474bcb2c867b2712298103bfb0673a51cc70cab7ed

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b1c014b3d0a160b201debddf5ba6e7f1526ec13040c66264ba984e57878763cf
MD5 bd6c98129a05369d3cf64fcda8805ded
BLAKE2b-256 0b833f7ebda59729b20fe27b5c0e85a715bbc90d92680e69e9c31bd79b7182e8

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f143419397af3f91e346c5c59764e3515a105bf458a3c8bcad501b850c20a39
MD5 02ff5138e032b5e30be1fab88d1672f3
BLAKE2b-256 d284eb017dc2146303620ab6ae0ab10ace66f922275fe7e5f6ce9018087199e5

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb6130f7e2549cbb2441c5ad8d2a6f2086c28041c1cc9585ebf1661d50c80ef1
MD5 67344eb936464c81a89a2c6df5638e75
BLAKE2b-256 5e78b524fde824d3b02f5926e21e45dbc9d0dc22c0da2582f5e1fceb99a0b203

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 00925c2f9266809db6788c618c0188ea99663a8cb28e5150158640a180e39bb9
MD5 149a907ee97af554008ec0041c2f18c7
BLAKE2b-256 fe0840ba5566a799b02046a2fb74918cdca2897531f5556551167071fc338429

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16f733b864f46f6cee0091b3e33d6e51d55280b83c4b52c335ca42c290f49b22
MD5 4281cfc250f009c1a97f241f8d218ef1
BLAKE2b-256 5f3c25782caa5a8111470c88f651d5132a8441a255c2394b53f5d4eadffa2669

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eacf2cc6c462afba3d495fb28777a8d981b97463b4a8bcba43a9490184d06b67
MD5 63bbdecfa041b2c304f6f2bddbf87ec1
BLAKE2b-256 703b221962c59e4fb4abaf6ae72c682ceb42f996c97eb6f8755b31d17c2a70cd

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f20eec10d43259506cf4917eec2c495af3ee7c4940c8cf3f432f62151c4bfba2
MD5 40b295f3a83f39fc35734a9121e4ab58
BLAKE2b-256 7a76c346ca584e86781bbc492018c2fc785d840333015c8c4d8a687ca72b8416

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2fdede94e1c7d04ea6e36c468a96d11a920004b887e3fe7cad813f49132ac746
MD5 d380ac628559d7797152d90b8cbe8664
BLAKE2b-256 d603f17329004fefa218772f0691d822ef940c291737b732e8ec28fa6cdab944

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55c9893e1ef73e14642d281ba1ba755b4026bb4973ea2a46c3f4b6b3ab36470e
MD5 f38519b749de0a4a8f57c3a0fe6abc1e
BLAKE2b-256 de57ca0bb511edd0be7929337290ebc3763028fe3e187f9e5c8e012a394281bd

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d940895de7ef3f107cd8d3d5821de0a1530aacebadc4f701524f05b9da5552eb
MD5 1f7f845e14b60341c92c55d1ec38a535
BLAKE2b-256 a8c4b4f2323c6fbc1cbd45ac3c8fd79dcacff451601bc203d430621d1357cc5d

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04324f6099ef3a0c74ec008a002a284cc8cd866f259e811347b68a4c7a73661b
MD5 2ef8923c39bd27bafb1a69bc2a32c5b5
BLAKE2b-256 97cb5013849657b68b97f222d9e445cccb14578385b5c0b58e48048c883ef8b7

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5b243e84027f07d322e969f1e5c8bdd4787e6649c2b74ff661a5d5d11c9c4a5
MD5 345a9198882f1b9969e24831f37a0d21
BLAKE2b-256 8eb222461d24963c3915b26868bdd1bcb575af53db73a0d4f30ff7e78a96c4e3

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 28de38f475c11f063cd3c556c9b9ba3c32e993bdacbb8b3abe1574cf541fedac
MD5 f289449da52a92d0de8f3c290b7e3d45
BLAKE2b-256 574cd0cd7386d6474de2cc04c04f05bcf8347a0bb8b1308fbea80a82d8e2e0ba

See more details on using hashes here.

Provenance

File details

Details for the file mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4743d12bc15b29e59f2dbd13f9b928b29686681ed4ac03afcf2de2c89931eab9
MD5 2563f8b7d1192232ef3989c3500ad675
BLAKE2b-256 5af942f504629cc4bb019294b5bb9636583b53b7752ecf49ac8fa76e8d3e2154

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page