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.6.0.tar.gz (487.5 kB view details)

Uploaded Source

Built Distributions

mqt_qecc-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.6.0-cp312-cp312-macosx_11_0_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

mqt_qecc-1.6.0-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

mqt_qecc-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.6.0-cp311-cp311-macosx_11_0_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

mqt_qecc-1.6.0-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mqt_qecc-1.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.6.0-cp310-cp310-macosx_11_0_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

mqt_qecc-1.6.0-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mqt_qecc-1.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.6.0-cp39-cp39-macosx_11_0_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

mqt_qecc-1.6.0-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mqt_qecc-1.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.6.0-cp38-cp38-macosx_11_0_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

mqt_qecc-1.6.0-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for mqt_qecc-1.6.0.tar.gz
Algorithm Hash digest
SHA256 0e58f876f7704836f99900926514f6b5dbb738c2f3e3fdf655097abb352b0a55
MD5 f6d3ac087f94f7cebf5d7ee12ccacc26
BLAKE2b-256 76974827111e87a01386386e561f389346313cf11fc627e67301a1fa39be5e3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 caa7a71928cced3718edb3340778de159c8961ccf12dc6a1d5dbad4875546183
MD5 ad4d5262d892a860ff9b08fb3e7bc65a
BLAKE2b-256 07bd6af8d05b1d6ff6aedc58a2f9cb67b63891fca38140ff53e8c033041da1df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7a8b7eb8751674951c4c5892c57c9e996de8cda679293b8bc2b8b5c0b2397003
MD5 4af4c73c9884327a7f3e60653f1f31f4
BLAKE2b-256 74dfba193a5dcf623c9c411fd63129c3dbb2a6971e034025a59a3109c98d9d54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f3395da98b5726a278105fa3703190d727477f379fec2529b2e418eef78eee3
MD5 b8b01c5f9259f467f112f29148fdf5c0
BLAKE2b-256 a396bffc08e3ee626e45953613e4995eb5f06ae2795064c3c212e39ea7a0708b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3df9f414d8844e787b38363164c1a14443b00f10100dbd532f8918fca68c6a01
MD5 4f0f4aaa1f02dfa6c85a85300b00a6f4
BLAKE2b-256 e9bb4651ded0f27d53ba3c0bf16b32ef345292c95a7998fe9486c55e1f5f779e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4c09fae56ee8265ad23fab0903e901b735234deef1c1d64f0fbe0b265575cc4c
MD5 7497e26bd82a6b2c0547de17177cf45a
BLAKE2b-256 b0dcde3aa052e9486bf5277dc1e2a80e0d85b9227c998ae8ca3251d6f1997df0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50db6b6db84b9d876b1a8e202ea0ee952af9cbc8d17c756ea52ce042e0becc9f
MD5 b5acc2c1eaaeb71786fab7397a33069d
BLAKE2b-256 33ac2b11205ba9baf5cccc0477a1da1b8a7e0110e07913b5df6bc4537f3687ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fdab099179fbda8617d31c089ca453c920af909b8f2197ee19d0ca969bfae79c
MD5 ff4211fabc1cd6981691105a0e0ff001
BLAKE2b-256 732320bcf2054bc1d19579ec219daa344591b88881bf011d3316756a17a626c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5bef54faf45e782f309a593611059e958c5700ce975947ec073834078023cec1
MD5 f625528e553614a23cbc8f1dadc40416
BLAKE2b-256 f6dae4e00d607518401933ada08342de7bc06e55c86682c288e1721e59942c65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24eb1c94823de75c2c48eeb439883aac5882c02cb3aae7c626c18c4f8bddf152
MD5 49c85564ae72238b9582641bc4ccb08f
BLAKE2b-256 c68fcc4beaf7ef9263edfe5b21443e588e3d0322deccb451aaefd18668b569a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2e9e2733ddc7ebb095732f9ab3021bd0835b99bfd24694eb7b943a9caac1edf
MD5 3530ffd270fcbdb6fcaeef3d8f7f3775
BLAKE2b-256 5f8ccbc6f052c6cafbad1b01c4b6b282cea30a38f50f242e560091f81f769adc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7cf74717d1b3b4ea4bda4913526895f645db7ab4fafeadbdbaace3a9b336cfb0
MD5 c4ec00e139409dd8f13487d520d83019
BLAKE2b-256 a3b63e3565b543200888d345b968662e16e94d8d1390dcc79b91fc19d7e89b3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c33021e35ea9a24a5662351da69bcffc56916a8c3bb5a0e32563288623e6cd4
MD5 a64281a07823baeb876a63b4a4268ce6
BLAKE2b-256 69ccc612cc6d68922ba769e4cd3e6bc8c3dc92d90d7d90fa57b3546d279e7e75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01bd19ddd47490e1dc8a2aa1d349329d994889d4e71e763f1fe2ff158e137d45
MD5 3532e4f9224031a7e891113ac4073737
BLAKE2b-256 d5201673a4e3613679eaa18ce667ab165231f0aebbcb3d5d05357afacd07b6fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 43167457acf7cd5d7e645747f80f3c16b9d57869b48688e2a8efe6ce66f38369
MD5 87826e0e77cd3afc305ad4671a5546ae
BLAKE2b-256 dcee3d7816fd9a19b30ee8c72fa8e6bcb5b6f5980711f3c2eacddb7578fa41b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.6.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec724c397b8c4e77ec54c68dd2a84a5451db0e078fa890cfd585c6cd37750c97
MD5 9d7427fe5e9b66c789820d6e6ff3ce0b
BLAKE2b-256 b34099247ad94fce4d687fea7827594385b17ec0db4bafc10477278859508ef0

See more details on using hashes here.

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