Skip to main content

FlamingPy is a cross-platform Python library with a variety of backends for efficient simulations of error correction in fault-tolerant quantum computers.

Project description

flamingpy_logo_light flamingpy_logo_dark

FlamingPy is a cross-platform Python library with a variety of backends for efficient simulations of error correction in fault-tolerant quantum computers.

Features

  • Simulates error correction on combinations of CV and DV codes to obtain estimations of fault-tolerant thresholds.
  • Supports encoding qubits into GKP states (more precisely, combinations of GKP and squeezed states).
  • Is conveniently modularized, allowing the user to insert custom noise models, codes, decoders, backends and other features.
  • Provides a host of visualization tools for ease of verifying correctness.

Download and installation

FlamingPy requires Python 3.8 or above. The recommended method to download and install FlamingPy, as well as all dependencies and precompiled C++ binaries, is through pip and our PyPI package. In your choice of CLI (with a Python environment activated) run the following single command:

python -m pip install flamingpy

Installation from Source (advanced users)

If you are a developer and wish to manipulate and test FlamingPy source code, you can install the project from Source. First, clone FlamingPy through the Code tab above. Then, create and activate a new virtual environment (if you prefer using an existing environment, you may need to uninstall existing FlamingPy builds). If you use Conda, for example, you may run the following:

conda create -n flamingpy python=3.8
conda activate flamingpy

Finally, change to the directory where FlamingPy was cloned and run:

python -m pip install -r dev_requirements.txt
python setup.py develop # only installs Python libraries
python setup.py build_cython --inplace # [OPTIONAL] compiles Cython-based backends
python setup.py build_cmake --inplace # [OPTIONAL] compiles CMake-based backends

The purpose of the commands is as follows:

  • The first command installs dependencies for building the project and testing purposes, and can be skipped if already satisfied.
  • The second command (develop) installs FlamingPy Python libraries without the compiling the optional backends.
  • The next optional commands compile various FlamingPy backends as required (given you have appropriate compilers pre-installed).

If you encountered a CMake error, you may need to (re-)install it through conda install cmake or other means before re-attempting the above. Furthermore, you may wish to try conda install git. For more detailed instructions and recommendations, including how to configure your environments, compilers and resolve errors, see our Frequently Encountered Errors page in the documentation.

Getting started and basic usage

There is a vast literature available to understand the theoretical concepts behind FlamingPy. For a self-contained description, see Xanadu's blueprint for a fault-tolerant photonic quantum computer. You can also visit the documentation, which will be updated with more resources over time.

To see a sample of what FlamingPy can do, let us first import a few important objects:

from flamingpy.codes import SurfaceCode
from flamingpy.cv.ops import CVLayer
from flamingpy.decoders import correct

Next, let us instantiate an RHG lattice -- the measurement-based version of the surface code:

RHG = SurfaceCode(3)

The integer denotes the code distance. By default, the boundaries are set to "open". Next, let us associate the nodes in the RHG lattice with CV states:

CVRHG = CVLayer(RHG.graph, p_swap=0.5)

Now, half the lattice (on average) will be labelled a GKP state, and the other half a p-squeezed state. Next, we can apply a noise model to the states:

grn_model = {"noise": "grn", "delta": 0.1}
CVRHG.apply_noise(grn_model)

This results in Gaussian random noise model with a squeezing parameter of 0.1 to the GKP states in the lattice. We can now conduct a homodyne measurement on the lattice to measure the syndrome:

CVRHG.measure_hom("p", RHG.all_syndrome_inds)

At this point, we are ready to perform error correction on the lattice. First, we can specify some options for the decoder:

decoder = {"inner": "basic", "outer": "MWPM"}

This corresponds to a basic GKP binning function for the inner decoder, and minimum-weight perfect matching (MWPM) for the outer decoder. Lastly, we can detect and correct for errors, and print a message identifying success or failure:

c = correct(code=RHG, decoder=decoder)
outcome = "succeeded." * bool(c) + "failed." * (1 - bool(c))
message = "Error correction {}".format(outcome)
print(message)

See our Documentation for more tutorials.

Contribution

We welcome new contributions -- simply fork the FlamingPy repository and make a pull request (PR) containing your contribution. All contributors to FlamingPy will be listed as authors on the releases. Users who contribute significantly to the code (new plugins, functionalities, etc.) may be listed on the arXiv preprints for FlamingPy. See our release notes and changelogs for more details.

Support

If you are having issues, please let us know by posting the issue on our GitHub issue tracker.

You can also start a general discussion and connect with our community members in our Discussions Page.

Attribution for authors

FlamingPy is the work of many contributors. If you are doing research using FlamingPy, please cite our paper below:

Ilan Tzitrin, Takaya Matsuura, Rafael N. Alexander, Guillaume Dauphinais, J. Eli Bourassa, Krishna K. Sabapathy, Nicolas C. Menicucci, and Ish Dhand, Fault-Tolerant Quantum Computation with Static Linear Optics, PRX Quantum, Vol. 2, No. 4, 2021, DOI:10.1103/prxquantum.2.040353

In addition to the authors above, the developers would like to thank Sanchit Bapat, Ashlesha Patil, Michael Vasmer, and Trevor Vincent for their contributions to the pre-release project.

License

FlamingPy is free and open source, and released under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

flamingpy-0.4.9a1-cp310-cp310-win_amd64.whl (191.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

flamingpy-0.4.9a1-cp310-cp310-manylinux1_x86_64.whl (193.0 kB view details)

Uploaded CPython 3.10

flamingpy-0.4.9a1-cp310-cp310-macosx_10_15_x86_64.whl (181.3 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

flamingpy-0.4.9a1-cp39-cp39-win_amd64.whl (191.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

flamingpy-0.4.9a1-cp39-cp39-manylinux1_x86_64.whl (191.0 kB view details)

Uploaded CPython 3.9

flamingpy-0.4.9a1-cp39-cp39-macosx_10_15_x86_64.whl (181.4 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

flamingpy-0.4.9a1-cp38-cp38-win_amd64.whl (191.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

flamingpy-0.4.9a1-cp38-cp38-manylinux1_x86_64.whl (191.0 kB view details)

Uploaded CPython 3.8

flamingpy-0.4.9a1-cp38-cp38-macosx_10_15_x86_64.whl (181.0 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

Details for the file flamingpy-0.4.9a1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 191.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 28b4d63b0d06f5363a35ede6c7fe6fbc48adc8b4a488d56c571645e8388118b6
MD5 099b874cd76ba3504357c91e2fe3cf7c
BLAKE2b-256 d39e00ead339aa9ac982801a1f30adf92a772e4a54f3bcdc52b7fa5c9c454dc9

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp310-cp310-manylinux1_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp310-cp310-manylinux1_x86_64.whl
  • Upload date:
  • Size: 193.0 kB
  • Tags: CPython 3.10
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 97db291b28f7a048f5ba61d07e5a63835fc42f38ca46901133e38238c3f40797
MD5 7739298dcd679d464dde368210f49a35
BLAKE2b-256 c7aa91ea84c05c000921c18638b2afa07aa4c8cf28e6d038b39c38e486ab5fcd

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 181.3 kB
  • Tags: CPython 3.10, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f54f9fe208d20f06d8ad9cfba6ab111c09095252a9042c6e753db47067f58be1
MD5 82a6970a92902962ff4712ad10283f49
BLAKE2b-256 055b61b6474cf9b4324fd2526b3b521d9367b6877d53d34d0e4d34e95ed9ea44

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 191.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f7ac82c69645bcf12b33d518f0f51f2029db73e41eb77ab417fcb9528fb65d69
MD5 088c4b1a576b417d519e1a13ebf21e2b
BLAKE2b-256 659f13d6f12843bf2c1e96b5a37ad0bb28cc7ffdd2198150e956e4e71c2b9691

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 191.0 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cbe16430b681f7f094334ac4f3f1e48d6baf240af5d3f33000e3d9f402ca9da5
MD5 bb88906bcb35eda9db5f0822736b1867
BLAKE2b-256 be948c857b5017d5d8ab23622470eee7604fd601708bc27d5c76d71a7ad1bb7c

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 181.4 kB
  • Tags: CPython 3.9, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5caf2cdd7f471a96ec70f34bc1c7dca4c48c635aa8bc80e7822050ad8508644b
MD5 757654234d46c6da3f7cf70469a6d88f
BLAKE2b-256 e087e85e6371576165cbfc886fa2513ce1699777c06720e8b31ee6e6d0121df7

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 191.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ce2d22fa8f6ab4aafc420bcd4a02ee32b9b7054cf3d9cca3d0ae5f7935dbac1f
MD5 c12173927427867e976b23d2a2ed056a
BLAKE2b-256 177651e0614322b5cf358401fe7e1d6daffc0c413ab429e4898b9b66b0cabf6f

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 191.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 321bd4af107a9e00c6a518428b9dea44d34dccf27fec495b439fc17f787044cc
MD5 a3b229bf2ed81eff74a959fbdacdbb79
BLAKE2b-256 66a13e3f26042eeefd6d0fefb221a97f8d0f8ff3d7bfb6b5aec076c0b30d946b

See more details on using hashes here.

File details

Details for the file flamingpy-0.4.9a1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: flamingpy-0.4.9a1-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 181.0 kB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for flamingpy-0.4.9a1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ce1d43a396d8efb876f8d4c41042019798ee0359726e1910433de3eaa87ddf43
MD5 bcf91689275c8f050b8b24a7704922e0
BLAKE2b-256 e8becf75ebb25b6419c0129dce874ed6d475015955533d44d2f90c97719e2b90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page