Skip to main content

QECC - An MQT Tool for Quantum Error Correcting Codes

Project description

License: MIT CI Python CI Bindings codecov

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

:warning: 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).
  • Apply error correction to quantum circuits.
    • The framework allows to apply different ECC schemes to quantum circuits and either exports the resulting circuits or simulates them using Qiskit [4]. Currently, 6 different ECCs are supported with varying extend 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 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, macOS, and Windows using the latest available system versions for GitHub Actions.

Reference

If you use our tool for your research, we will be thankful if you refer to it by citing the appropriate publication:

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

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.2.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

mqt.qecc-1.2.1-cp311-cp311-manylinux_2_28_x86_64.whl (17.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

mqt.qecc-1.2.1-cp311-cp311-macosx_10_15_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.11 macOS 10.15+ x86-64

mqt.qecc-1.2.1-cp310-cp310-manylinux_2_28_x86_64.whl (17.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

mqt.qecc-1.2.1-cp310-cp310-macosx_10_15_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

mqt.qecc-1.2.1-cp39-cp39-manylinux_2_28_x86_64.whl (17.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

mqt.qecc-1.2.1-cp39-cp39-macosx_10_15_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

mqt.qecc-1.2.1-cp38-cp38-manylinux_2_28_x86_64.whl (17.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

mqt.qecc-1.2.1-cp38-cp38-macosx_10_15_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

mqt.qecc-1.2.1-cp37-cp37m-manylinux_2_28_x86_64.whl (17.7 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.28+ x86-64

mqt.qecc-1.2.1-cp37-cp37m-macosx_10_15_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

Details for the file mqt.qecc-1.2.1.tar.gz.

File metadata

  • Download URL: mqt.qecc-1.2.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for mqt.qecc-1.2.1.tar.gz
Algorithm Hash digest
SHA256 c4cde7179a8ac20e8722d266e9af079abb196befba7fedb17f5779163f31cf8a
MD5 697a1fa7025be7ad838fe4f4934f5bee
BLAKE2b-256 c04e00a3bba767ef7ebf803013d1743fac48380daac4fe9657084820a01396c6

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 325b3d943494377f2e21255adc63ba46a4439aedd636a7f67cedb8b37d6b1f65
MD5 3bb02f43fc263f454b5d07c5d4fdca48
BLAKE2b-256 5e3785f84414d449b8eff19c2dfcd7cf0b618c6545a4546b5f51fb3fa983b933

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp311-cp311-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a8aaf1c12ecf1167b876f2b86455b845b7d3ce80a0453bb7961e4b8bd203351a
MD5 883ba443d2659997f36c70969d51a090
BLAKE2b-256 18155e6ab47336af37646e889b7b59dd838d5d6285d99b12dfcfc50531d5a010

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ee214a3984fcbb307b9d6c123e6557b3e303ce5db4a895da5f6e798735bc5a2d
MD5 6087b7a649ada996705d776c62e50355
BLAKE2b-256 eba4c4c2825fe0dc52d99f6082bbca835eef31a27c2065de5cf45f645609c176

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 82d8767ce508492f088aead0663f3cbc2dc9b81f21e29cd1b15b14b8ee989346
MD5 769fb532d098826f5719f7a2924acffb
BLAKE2b-256 b416ddcf2bebd7e68aa47d2a5a99667b46e8f3dbc7cb041e8579ea40b72a663b

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc21c4d02572f2b513c4fce4d5e8ec50bafd621234e5ebc2c3253c0b114cc14e
MD5 e2939cf98637664c15addb73055ef71e
BLAKE2b-256 6eec636ea087157523432e45cfe45727072737978f340bd366d64f3ee37e0efc

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 50711064311b031f6eaa9c06a875cec37ec1c6e5d409beed17c73167b9bf419e
MD5 ac5e98ba63958ff6eccad5af83cf5ce3
BLAKE2b-256 b17449d6ea9428538eeb7f0b18952c6c26fe57b2a75120f7a6d09ea72299c4d1

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af9064d77d5198e365907f95a80280c58e53e5b0cc86f6bb73cb67f1f4c039ba
MD5 05341c02a89aba5d05c89405815f5c1e
BLAKE2b-256 dca7b3f47295ea02ad53e17e01d01c94a28ee5ceb5339641c24fd07b3d016b1b

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7c630bb54e86db61c8c9ea122412f223db96444e4508c96c5c8d84342661567c
MD5 d0c249b15047e7fdb36e66e4dff4b0b5
BLAKE2b-256 7a5ad04fba79347060ab6430c92406b9c002ae92f0ce80cc6fed31056d9a489e

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp37-cp37m-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp37-cp37m-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9566bd4f30ffe2ac898271a8d3d486569c16e390ec2cd358eb93db2d575f3ed0
MD5 3e078fc1761eb2f419ab6a9eaf1efc48
BLAKE2b-256 17329640151df29fd8aa79e6a7d2e73ef6b1c2280e7c29b5846e8e2f80eeb9b1

See more details on using hashes here.

File details

Details for the file mqt.qecc-1.2.1-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mqt.qecc-1.2.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5c9ff2a853034f3cad55c022709af0ffb7f8da128dd9c755a5e5296b7d2fc532
MD5 af746b6ed411bc0600de410ba084e065
BLAKE2b-256 782aa1da3d5425175877f58d2baba6a543d737804f4bcacde18a2071782d5819

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