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

Note you will need to remove the comments manually if you use Windows prompt. 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 compiling the optional backends.
  • The next optional commands compile various FlamingPy backends as required (given you have appropriate compilers pre-installed).

If you encountered CMake errors, 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 git-related errors. 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, 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

See our contributions policy and list of contributors to FlamingPy here.

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.8.2a5-cp310-cp310-win_amd64.whl (200.1 kB view details)

Uploaded CPython 3.10Windows x86-64

flamingpy-0.8.2a5-cp310-cp310-manylinux1_x86_64.whl (203.1 kB view details)

Uploaded CPython 3.10

flamingpy-0.8.2a5-cp310-cp310-macosx_10_15_x86_64.whl (191.1 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

flamingpy-0.8.2a5-cp39-cp39-win_amd64.whl (201.0 kB view details)

Uploaded CPython 3.9Windows x86-64

flamingpy-0.8.2a5-cp39-cp39-manylinux1_x86_64.whl (202.2 kB view details)

Uploaded CPython 3.9

flamingpy-0.8.2a5-cp39-cp39-macosx_10_15_x86_64.whl (192.2 kB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

flamingpy-0.8.2a5-cp38-cp38-win_amd64.whl (200.7 kB view details)

Uploaded CPython 3.8Windows x86-64

flamingpy-0.8.2a5-cp38-cp38-manylinux1_x86_64.whl (201.8 kB view details)

Uploaded CPython 3.8

flamingpy-0.8.2a5-cp38-cp38-macosx_10_15_x86_64.whl (191.9 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

File details

Details for the file flamingpy-0.8.2a5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 65863e5b445960249508b758a2805d2ee808f64f40c558198fa7a6ce3bedd611
MD5 964b4fd0ec3b0d596b9caa06ae8ef3b2
BLAKE2b-256 c9241fe3a73e82f480cd2c442701fb6bf762d2a105cb8e2debc2a05e9ee3ace9

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f916d578bef763bd1992cd35cc29f0e30f7d1ab9d17cb21a36148a8974ab7f8d
MD5 5bf559349b9a5e2929e2ef706dd5ad29
BLAKE2b-256 c22e3f6d84cc2f9c2a73d1c4ec85b9f66ea65d36684aa78f44f390364ba668ad

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d7f6dbc944d36b1e42d7353b65c0ce114b8f81010402ed5a6f761c451c7b442c
MD5 7e00e44043dc668f2c4ee5b60e37c791
BLAKE2b-256 8a7e35cd74ba2ffa0dbc26a9d40836143e6304a1867798c62d6d4a4d5f4f4a74

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: flamingpy-0.8.2a5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 201.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for flamingpy-0.8.2a5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 60f0bdbaf69131d9db893bde555330b1d84306459e5db5e412d9085a5b0c7435
MD5 2b1126bc520b4aa41d6c6ae43874967d
BLAKE2b-256 0cf9717476fc2d273fe798264d538df55040f953d46b7a30f8a063a3e57b743b

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6afb49a55d9d0013e73343af0877acc41b371cfc971cdf9f99044966979d902e
MD5 fa3c16989c87b36dc39a3ccecdac29db
BLAKE2b-256 adbc6d3769fc4f0cc0a612633701dd633a78f0cdc8f511a62e088fcfc51b8ce1

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 41ef69147cddec21d96a11abb1441a8b9eaa7a6e6694b551b20473ff0bc37e95
MD5 c963d49a858c97f9da734848b813cf15
BLAKE2b-256 3c95f404fa8cfab4f0195262831a3d5eaeb5610ee753b35e8fa6b2ad6b4beaba

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: flamingpy-0.8.2a5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 200.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for flamingpy-0.8.2a5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 77f265bde41f30054fc980ffa390ef8edb9a01a5362ea2211a74167be3a44c69
MD5 f35bec62e4cc0aa6effcc0f888e09a9d
BLAKE2b-256 11e483b3e6ba446940f3518012ad5017bd073c27cec341052a013c795adfe865

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 abb2ad74de68e2641ace8bc4579e88d6e06425c420c4a26d3767f54fa2d4e343
MD5 f1bbde01dda9c6317a6ca2436aa18f86
BLAKE2b-256 20814163991f0ace238232969548b9bdfe391ac7c09f3100297da27e51b36c25

See more details on using hashes here.

File details

Details for the file flamingpy-0.8.2a5-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.8.2a5-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 28425ca4a9e3f492fd20452b428082b1a6928b9f22f9ad29f002ab2bb4c23297
MD5 ea3410d12cc50bfe005b1c6dbe825bcd
BLAKE2b-256 11c2c1758720d5491ea9e73b91436dbae629383b3e320cb4f50e72d376b629a9

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