Giter Club home page Giter Club logo

mqt-qecc's Introduction

License: MIT CI Python CI Bindings 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 [email protected] 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

mqt-qecc's People

Contributors

33gjl1xe avatar burgholzer avatar dependabot[bot] avatar lucasberent avatar peter-janderks avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mqt-qecc's Issues

Include python 3.11

What's the problem this feature will solve?

As remarked in #74 (comment) python 3.11 should be supported.

Describe the solution you'd like

Include py 3.11 in config files

✨ Add description of Q18Surface Code

What's the problem this feature will solve?

Currently, the Q18Surface code of the EccFramework is based on its referenced paper, but does not completely rely on its ideas.

Describe the solution you'd like

After adding a description, it should be more clear which concepts are taken from the respective paper, and how the code is built up in detail.

πŸ› Unable to pip install editable version

mqt.qecc version

mqt.qecc 1.3.1

OS

20.04.1-Ubuntu

Python version

Python 3.10

C++ compiler

No response

Additional environment information

No response

Description

When I follow the build instructions at https://qecc.readthedocs.io/en/latest/DevelopmentGuide.html errors occur:

Specifically when I type pip install --editable .[dev] this error occurs (The project also doesn't install without using the editable mode):

  error: subprocess-exited-with-error
  
  Γ— Building editable for mqt.qecc (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [156 lines of output]
      /tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
        config = read_configuration(filepath, True, ignore_option_errors, dist)
      running editable_wheel
      creating /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info
      writing /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/dependency_links.txt
      writing entry points to /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/entry_points.txt
      writing requirements to /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      no previously-included directories found matching '**/apps'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc-1.3.2.dev5+g97b9c9a.dist-info'
      creating /tmp/pip-wheel-7cj88rx4/.tmp-kn816tck/mqt.qecc-1.3.2.dev5+g97b9c9a.dist-info/WHEEL
      running build_py
      running build_ext
      -- The CXX compiler identification is GNU 9.4.0
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Performing Test HAS_MARCH_NATIVE
      -- Performing Test HAS_MARCH_NATIVE - Success
      -- Could NOT find GMP (missing: GMPXX_LIB GMPXX_INCLUDE_DIR GMP_INCLUDE_DIR GMP_LIB)
      Did not find GMP. Using Boost multiprecision library instead.
      -- Boost.Multiprecision: standalone mode ON
      -- Using the single-header code from /home/pderks/Documents/phd/qecc/extern/qfr/extern/json/single_include/
      -- pybind11 v2.11.0 dev1
      -- Found PythonInterp: /home/pderks/Documents/phd/qecc/qecc_venv/bin/python3 (found suitable version "3.9.7", minimum required is "3.6")
      -- Found PythonLibs: /home/pderks/anaconda3/lib/libpython3.9.so
      -- The C compiler identification is GNU 9.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      CMake Error at /tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find FLINT (missing: FLINT_LIBRARY FLINT_INCLUDE_DIR)
      Call Stack (most recent call first):
        /tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
        cmake/FindFLINT.cmake:83 (find_package_handle_standard_args)
        src/CMakeLists.txt:32 (find_package)
      
      
      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 344, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 267, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 294, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 94, in build_extension
        File "/home/pderks/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/home/pderks/Documents/phd/qecc', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/tmp2h4mezoc.build-lib/mqt/qecc', '-DPYTHON_EXECUTABLE=/home/pderks/Documents/phd/qecc/qecc_venv/bin/python3', '-DQECC_VERSION_INFO=1.3.2.dev5+g97b9c9a', '-DCMAKE_BUILD_TYPE=Release', '-DBINDINGS=ON', '-GNinja']' returned non-zero exit status 1.
      /tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py:988: _DebuggingTips: Problem in editable installation.
      !!
      
              ********************************************************************************
              An error happened while installing `mqt.qecc` in editable mode.
      
              The following steps are recommended to help debug this problem:
      
              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.
      
              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:
      
                  https://github.com/pypa/setuptools/issues
      
              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************
      
      !!
        cmd_obj.run()
      Traceback (most recent call last):
        File "/home/pderks/Documents/phd/qecc/qecc_venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/pderks/Documents/phd/qecc/qecc_venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/pderks/Documents/phd/qecc/qecc_venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
          return hook(wheel_directory, config_settings, metadata_directory)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 445, in build_editable
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 102, in <module>
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 344, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 267, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 294, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-bcf33gnq/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 94, in build_extension
        File "/home/pderks/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/home/pderks/Documents/phd/qecc', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/tmp2h4mezoc.build-lib/mqt/qecc', '-DPYTHON_EXECUTABLE=/home/pderks/Documents/phd/qecc/qecc_venv/bin/python3', '-DQECC_VERSION_INFO=1.3.2.dev5+g97b9c9a', '-DCMAKE_BUILD_TYPE=Release', '-DBINDINGS=ON', '-GNinja']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for mqt.qecc
Failed to build mqt.qecc
ERROR: Could not build wheels for mqt.qecc, which is required to install pyproject.toml-based projects```

### Expected behavior

I expected to be able to run `pip install --editable .[dev]`

### How to Reproduce

Follow steps 1-7 at [https://qecc.readthedocs.io/en/latest/DevelopmentGuide.html](url) and then run `pip install --editable .[dev]`

πŸ› Solve the "PendingDeprecationWarning" when using Qiskit

mqt.qecc version

current

OS

All OS are affected

Python version

No response

C++ compiler

No response

Additional environment information

qiskit==0.39.4
qiskit-aer==0.11.2

Description

Currently Qiskit's QasmSimulator is used for quantum circuit simulaton in the ecc_framework_qiskit_wrapper. However, in the future, the QasmSimulator will be fully replaced by the AerSimulator of Qiskit.

Using the QasmSimulator causes "PendingDeprecationWarning" warnings. These warnings are currently filtered in pyproject.toml, to not cause errors during the CI checks.

Expected behavior

The simulator used to simulate quantum circuits must be switched while making sure that the functionality is not reduced. Afterward, the filtered warnings in pyproject.toml regarding the "PendingDeprecationWarning" warnings can be removed.

How to Reproduce

Remove the Qiskit PendingDeprecationWarnings of the filter from pyproject.toml. Then running the pytohn tests will cause an error.

Fix py wheels windows

Currently flint cannot be auto installed since flint's cmake is broken. For now flint needs to be installed when using the python package on windows.

Remove `qiskit-terra` dependency in favor of `qiskit`

mqt-qecc depends on qiskit-terra (>=0.23.0) https://www.wheelodex.org/projects/mqt-qecc/ which is reaching EoL:

Important

The package qiskit-terra is not going to be updated after August 15th, 2024. Since Qiskit 0.44 (released on July 27th, 2023), the qiskit meta-package only contains qiskit-terra. In Qiskit 1.0 and beyond, the meta-package architecture is removed.
If you are installing or depending on qiskit-terra, consider changing that to qiskit: Either qiskit>=0.x,<1 (if you did not transition to Qiskit 1.0 yet) or qiskit>=0.x,<2 (to also include Qiskit 1.*).
Read more.

✨ change PyPI upload option to kebab-case

What's the problem this feature will solve?

https://github.com/pypa/gh-action-pypi-publish changed the naming convention for action parameters from snake_case to kebab-case. While the old syntax will be supported until the next major version increase, a warning is admitted as of the latest version.
This PR changes the skip_existing option to skip-existing to reflect the above change and silence the warning.

Describe the solution you'd like

cda-tum/mqt-qcec#256

✨ Only require C++17

What's the problem this feature will solve?

At the moment C++20 is required to build QECC. The standard is still pretty new and it's adoption in compilers such as gcc and clang has been slow. As a result, the default version of gcc (9.4.) that comes with the last LTS version of Ubuntu (20.04) is not able to compile the project. While there are multiple solutions, such as upgrading the compiler or switching to the latest LTS version (22.04), this is not possible under all circumstances.

The library itself is not using any crazy new C++20 features. It merely uses the spaceship operator and things like map.contains. It should be relatively straight forward to lower the requirements of this library to C++17.

Describe the solution you'd like

QECC should be compatible/compilable with C++17.

Non CSS codes

Nice work! just to confirm some detail.

  • Does this work for Non-CSS codes? When I read the paper and codes, it mostly says Hx and Hz, which are typically for CSS codes. Does this program also work for Non-CSS codes with mixed X and Z parity checks?
  • If so, would you mind giving an example of decoding the perfect five-qubit codes with shifted XZZX checks?

Fix cc-cache for python workflow✨

What's the problem this feature will solve?

currently cc-cache does not work for python due to build technicalities.

Describe the solution you'd like

Once this is resolved, cc-cache has to be adopted accordinlgy to work across the python workflow as well. This builds on #128

Encoding not working correctly on noiseless simulation πŸ›

Environment information

  • mqt.qecc version 1.5.0
  • qiskit version 0.45.1
    (also the case with the simulator from our project, qrisp, but for best reproducability I included a qiskit file so you can check the issue)

Description

The error corrected circuit has incorrect output when measuring Z on all data qubits.
Therefore, the ECC protocol does not work.

Expected behavior

Correct encoding resulting in correct logical qubit when measuring data qubits

How to Reproduce

  • run the following python code. This circuit should result in an always measurement outcome of 1.
from mqt import qecc
from qiskit import QuantumCircuit, Aer, execute, ClassicalRegister
from qiskit.compiler import transpile

file = "./minimalbeispielsource.qasm"
ecc = "Q7Steane"
ecc_frequency = 10
qc = QuantumCircuit(1)
qc.x(0)
qc.qasm(filename=file)
result = qecc.apply_ecc(file, ecc, ecc_frequency)
circ = QuantumCircuit.from_qasm_str(result["circ"])

cr = ClassicalRegister(1,'my_reg')

# measure encoded logical qubit by measuring logical Z = ZZZZZZZ
circ.add_register(cr)
for i in range(7):
    circ.measure(circ.qubits[i],cr)
    
    
simulator = Aer.get_backend('qasm_simulator')

# Transpile the circuit for the simulator
transpiled_circuit = transpile(circ, simulator)

# Run the simulation
job = execute(transpiled_circuit, simulator, shots=1024, optimization_level=0)  # You can adjust the number of shots as needed
result = job.result()
# Get the counts from the simulation results
counts = result.get_counts()
# get the measurement outcomes
states = [k for k, _ in counts.items()]
# get the logical measurement results for encoded qubit
res0, res1 = 0, 0
for state in states:
    if state[0] == '0':
        res0 += counts[state]
    elif state[0] == '1':
        res1 += counts[state]
print(states)
print(f"We got 0 {res0} times and 1 {res1} times")

πŸ› fix ECC framework tests

mqt.qecc version

mqt.qecc==0.0.2

OS

Ubuntu 22.02

Python version

No response

C++ compiler

No response

Additional environment information

No response

Description

currently the ecc framework tests seem to be broken due to a new Qiskit version. This was for now fixed by capping the qiskit version #93. Instead, the framework should be updated to work for current versions and the version cap should be removed accordingly.

Expected behavior

No response

How to Reproduce

tests fail, e.g. see https://github.com/cda-tum/qecc/actions/runs/4408857033/jobs/7724404102?pr=85

How to run mqt-qecc on google colab

Discussed in #223

Originally posted by hardik954 May 5, 2024
I want to run the "[test_analog_tannergraph_decoding.py] present in the test.python.analog_info in GOOGLE COLAB folder but how do I do it? I have cloned the repo installed all the requirements yet i can't do it. Can someone please help me

Adopt ccache for faster C++ CI builds

What's the problem this feature will solve?

CI builds can be quite slow and take up a considerable amount of time. ccache, in particular https://github.com/hendrikmuhs/ccache-action allows to set up a consistent compiler cache for your GitHub CI workflows that speeds up compilation across runs.

Describe the solution you'd like

Adopt ccache for our CI builds. Should be as simple as

- name: Setup ccache
  uses: hendrikmuhs/[email protected]
  with:
    key: '${{matrix.os}}-${{matrix.compiler}}-${{matrix.build_type}}'
    variant: ccache
    save: true
    max-size: 10G

and passing -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache to CMake.

Some slight modification might be necessary for Windows.

πŸ› Incomplete Example

mqt.qecc version

latest

OS

any

Python version

any

C++ compiler

any

Additional environment information

N/A

Description

The example file that is provided in the docs in the walkthrough section (https://qecc.readthedocs.io/en/latest/Installation.html#a-detailed-walk-through) is incomplete and does not work out of the box. It is missing the import of the library.

Expected behavior

The example should be complete and executable without modifications.

How to Reproduce

Copy the code from https://qecc.readthedocs.io/en/latest/Installation.html#a-detailed-walk-through and run the script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.