Installation

QECC is mainly developed as a C++ library. In order to make the tool as accessible as possible, it comes with an easy-to-use Python interface.

We encourage installing QECC via pip (preferably in a virtual environment):

(venv) $ pip install mqt.qecc

In most practical cases (under 64-bit Linux, MacOS incl. Apple Silicon), this requires no compilation and merely downloads and installs a platform-specific pre-built wheel.

Warning

Currently the FLINT2 dependency is not automatically installed. Thus, windows users need to install FLINT2 by hand. Either by building from source or downloading the corresponding .zip file. We are working towards fixing this issue.

Note

In order to set up a virtual environment, you can use the following commands:

$ python3 -m venv venv
$ source venv/bin/activate

If you are using Windows, you can use the following commands instead:

$ python3 -m venv venv
$ venv\Scripts\activate.bat

It is recommended to make sure that you are using the latest version of pip, setuptools, and wheel before trying to install the project:

(venv) $ pip install --upgrade pip setuptools wheel

A Detailed Walk Through

First, save the following lines as steane_example.py in a folder where you want to install QECC and run the example:

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
residual_err = np.array(x_err) ^ np.array(result.estimate)

print(result)
print(code.is_x_stabilizer(residual_err))
print(np.array(x_err).astype(int))

Then, the following snippet shows the installation process from setting up the virtual environment to running a small example program.

$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip install -U pip setuptools wheel
(venv) $ pip install mqt.qecc
(venv) $ python3 steane_example.py
{
    "decodingTime(ms)": 0,
    "estimate": "[0,1,0,0,0,0,0]"
}
True
[0 1 0 0 0 0 0]

Building from Source for Performance

In order to get the best performance out of QECC and enable platform-specific compiler optimizations that cannot be enabled on portable wheels, it is recommended to build the package from source via:

(venv) $ pip install mqt.qecc --no-binary mqt.qecc

This requires a C++ compiler compiler supporting C++17 and a minimum CMake version of 3.19.

The library is continuously tested under Linux, MacOS, and Windows using the latest available system versions for GitHub Actions. In order to access the latest build logs, visit qecc/actions/workflows/ci.yml.

Note

We noticed some issues when compiling with Microsoft’s MSCV compiler toolchain. If you want to start development on this project under Windows, consider using the clang compiler toolchain. A detailed description of how to set this up can be found here.