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

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

Uploaded Source

Built Distributions

mqt_qecc-1.7.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13t manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13t macOS 11.0+ x86-64

mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_arm64.whl (992.8 kB view details)

Uploaded CPython 3.13t macOS 11.0+ ARM64

mqt_qecc-1.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13 macOS 11.0+ x86-64

mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_arm64.whl (987.6 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

mqt_qecc-1.7.2-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.2-cp312-cp312-macosx_11_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

mqt_qecc-1.7.2-cp312-cp312-macosx_11_0_arm64.whl (987.3 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

mqt_qecc-1.7.2-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.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (975.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mqt_qecc-1.7.2-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.2-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.2-cp310-cp310-macosx_11_0_arm64.whl (974.7 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mqt_qecc-1.7.2-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.2-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.2-cp39-cp39-macosx_11_0_arm64.whl (974.8 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for mqt_qecc-1.7.2.tar.gz
Algorithm Hash digest
SHA256 73d3215bf71f0bf4a1e2d73eae761e18941a8c9e2845cc2055928f5f72bc8e5b
MD5 8002a207988339a924a4acfa8f1b81f4
BLAKE2b-256 e53d110d42d9e0e88d947779542b3ee9674dc74711168f5b92c77eb2b6b33b1c

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44b04c0de07afa2a7c9a1a4b3d2fd81802d4d0f13142db66efed4677689754f7
MD5 bd28ff3e63bf36397d7d08ef9a0ee225
BLAKE2b-256 71fc20db2605a10515d8e9b9110f2da1f1faf8fb347f5c47ee077176197b332d

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 25970914ab282fbae97f19334e74533225cfa0e26cf6d07925da16a0266a96d0
MD5 96bba970254a27849f96bd94e56fb783
BLAKE2b-256 aa21537412a6ba894e17676121a1663b92aff3534bc2c927432d66558dbf9ca4

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 64506c733df869f9c4d9dced75fba1476820161604af7f5e49f3b43c20da7163
MD5 93c04d4786866bba7eff73f184c4facd
BLAKE2b-256 a0ca44f534cf50e4efed74a750cf4d70660fdad92be7cd4c6ff79a3a6f00943b

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a525c2c55d20f6e9c3ad7e2f0bec11e337e95a67ca2425ba23e208a61238507
MD5 b1142971677ab34421aaadc2d3d34e45
BLAKE2b-256 7be47b528f1027253ba981401892a2f722b095b1a96b0a72098fc76589d0a042

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b78f0e2a4913267628e11aa58e3a1574bbba9e81f10b79c241ea76bfda6a232c
MD5 380f19ad9097af3b40bb42735985dfc6
BLAKE2b-256 b96ee2edc3719eb171ecbd7989e0a9e5c67c616db745b8ee2c0c44cad1915528

See more details on using hashes here.

File details

Details for the file mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3963fb04e25a420823207cf92543d0c0c4762ef80dde9acf02c6e8d84fa916f5
MD5 84436aad645f2d425da1b02a177cf7c2
BLAKE2b-256 894710f6dcaedea4d1507fb00de3f6450889d664d96a7212ca453335dbd0f867

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87bebf8e428906679fde7ba026677cc1630cd907fc9ead9430debc33cb54b711
MD5 1f702c26aa846d69877bd04a631be993
BLAKE2b-256 ebbc81d4e7afca35973d4d5dfffd406f308372d44fa922ade41ed4f81b0f4260

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 34ef43f51f6e500750ae70db16da5c12d9dc1ab3b100525bde24b9db6e8867cf
MD5 9a55d73c30f341fe320aebded7f39689
BLAKE2b-256 6aff6a319370bf2b6a17bc4b264faafeffaa7c9f047370140792ef710e7e91cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2be697df447a6e5204644388b2eebdabc45b3c6c2a7ee89df8afc21cf72f8a82
MD5 da3dabb75a41154cd8d9bfd12a7080c6
BLAKE2b-256 904ed0c4b9393a2a5fcda558b92eb8b6c9ee4142b61c02bed467f4cc8cd4b30a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21ea8eb1068d3735d1e0507e2daea0c7371cf2a5f85fcd002ec9a5442821a07b
MD5 fb636689bc578c0a73dfef5df6f9d349
BLAKE2b-256 9c46425bfe8c85ad7f490d50b590b8c9d137ded250e549cfad0389be4567d0b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 468756a5a68381080071c5af2c9d2dc494a95df017c0234261e1d2346fe1f8c4
MD5 12bf38d0ec20340e721e77e118a2f231
BLAKE2b-256 8b622f0fab7bc07a20198f115bec6ce123297258603d7bb2ad38ab1bc25ae0c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 708ec19efe0e706e6797e8141429d79c8ed6462b4408c38c5309aa4fafd51fe2
MD5 f51ff189019b01a4bb4db1afd21e0839
BLAKE2b-256 edaab98f36b4c62ffdeb55d9ad9ffeebe95bab63f29cccf2fa41a1b3969a0c05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b05bc2eb8d00b1e83d5d92f9ae18526b989ac34f4328217e135e10144cc3e80f
MD5 8a64c3e936e11ada92ee1c90f9c69ca2
BLAKE2b-256 b6a4e5405eae46ef336d57ec04090fa94c69431f93ed0a6a43f75b1265ee5238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5b72d3b5e3c47ecbc351cc40aa610a6599100538af59f0df6585166cd546ece8
MD5 dec47cda1e22793edee4a9e5adc2a459
BLAKE2b-256 a1d84948fa7735ce2815c1ab5f3b64516bebaad4fa699ccb0f14db12b599944b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7735e9f331d5943f842a2a5f5de9a1ad115ec392e3ebe151ae92fd49329d9d0
MD5 c29f6f8103f6aa9c1641cebc544296e3
BLAKE2b-256 8e9a8f6e310dd22aa5b1d1b7f3e0f2aedc9c53d54ed7fd501f1a72370ed40ed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84f546018b67e79619166f1de44d6681d4755f1bbc3d6b10162d4f0ab1897767
MD5 28425964689ceb002470f59667e18491
BLAKE2b-256 a3f41e767b90e37da9ca3fef8ef463ad8e9af680b8c8bd6fdfd226c47d9f3543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1b2005b7cbffd1f4fac520b9b9de571f78bb161f47f850490879aa319c5fa242
MD5 c88f0d72c36c52a77da91a3cb58f26e4
BLAKE2b-256 4a41ab2f582794e6ef0eb0bf46449a4d92e644e9eba2dc98ed9326e76ca5276f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mqt_qecc-1.7.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edf8e4869d9f1d7e50b1febd3afe37f63d2092e75761b2f8ecb852ceca24c123
MD5 4539d1675ddc7e689f2565eb96faa55c
BLAKE2b-256 99b35b72c25ee97a7d72c277a0b6ac2d270202dc6fda4d78526bc7d67b2ae2da

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