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

Logo Logo

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+. 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)

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 changelog for more details..

Support

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

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

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.6a1-cp310-cp310-win_amd64.whl (191.8 kB view details)

Uploaded CPython 3.10Windows x86-64

flamingpy-0.4.6a1-cp310-cp310-manylinux1_x86_64.whl (191.5 kB view details)

Uploaded CPython 3.10

flamingpy-0.4.6a1-cp310-cp310-macosx_10_15_x86_64.whl (181.4 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

flamingpy-0.4.6a1-cp39-cp39-win_amd64.whl (191.5 kB view details)

Uploaded CPython 3.9Windows x86-64

flamingpy-0.4.6a1-cp39-cp39-manylinux1_x86_64.whl (191.1 kB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.9macOS 10.15+ x86-64

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

Uploaded CPython 3.8Windows x86-64

flamingpy-0.4.6a1-cp38-cp38-manylinux1_x86_64.whl (191.2 kB view details)

Uploaded CPython 3.8

flamingpy-0.4.6a1-cp38-cp38-macosx_10_15_x86_64.whl (181.1 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 191.8 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 996c9bf5b1f4bfded60b68d1a4980acaadf66645128738c2d5c8908ec330fa9c
MD5 b8163c17538cfea2c2b2a9b7de7b3b33
BLAKE2b-256 9d639367d952882efc4361a8233893691eed590035d6c25736429d7d5f99c217

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp310-cp310-manylinux1_x86_64.whl
  • Upload date:
  • Size: 191.5 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d7545e2a442676cac20748bcfa49b7cffa25740979ea77c5add0b9108c7aacb1
MD5 04ae4bc21535a63c70ca1c082a63a1b7
BLAKE2b-256 3da274831f5f79024672055314a6ef65760ac0b3a9199aa82bd2ca5ce0761eba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 181.4 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f5c66fbef7335835ee9793db59518db5b1c63b2218242a91086130256419a10e
MD5 ef2028f5b05632aecf7759c8163e0b1b
BLAKE2b-256 d397277a74bc9743977a7966fb09183e5ca9f8d16422fa97023f72a6e1b11d43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 191.5 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f65c89382628334337927130472ddd078b1722fe7ae4e133d7aef8954e78d12a
MD5 f197455f75be88705ceab02b79a3d677
BLAKE2b-256 a1f0b1ca702109375facd3f62ecaf23278fbdcfd08c7ed7ea391a6cff4314656

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 191.1 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ab635ebd07be7d89d2ffffba78afef956c5db237a818cf0e583a9a90ad8a4f5d
MD5 f2e39917287b3272551951108ff600f2
BLAKE2b-256 ad2d71761185663df5abd8c1febcc6d3932836cb6a94ecc24c6f25e275f6a28e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 32969413975d5844c67e91f94824f3de1b70cb068119703e0f2f00fbe1d289f4
MD5 f7af5311fd8f3a6310edccf17e7f9f36
BLAKE2b-256 7aa41d385bcaffd97e12920f9e01cd8aa18284803221eeb3fab819311bc98ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d87d4b1a58526813e20c746473f6b6bf8e347fd7969bdeb3314e9ccae17b1c91
MD5 09e205367be10ad718bb7c919908e65c
BLAKE2b-256 fd1df55fab6eb7028b3ae6497421b5fd68c358a2e868b1855191d03e56f25d91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 191.2 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 11736d15b040ec61be918fd4623344043e57eea5f0a494c78784dc19b05f641c
MD5 bfb07f2a69957e5e58601b28ba20ec99
BLAKE2b-256 ac70834f3795a3fc9af7d178f0e1da3fc527c8f565ed0902fb186efada39b9ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flamingpy-0.4.6a1-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 181.1 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.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for flamingpy-0.4.6a1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 9144faa7c31770f431add45e5c453450e9d0820b8883bc017586405bb4a64959
MD5 d0672eded7afb2456258a02fb3f6c92d
BLAKE2b-256 f2c65e946e588edb7cda5e3e0e489bc979a312f99d4ba549ef429b2e30bf66ed

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