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 continuous-variable (CV) and discrete-variable (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_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 command compiles 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.

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.noise 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". Now, let us define and apply a continuous-variable noise model to the code:

CVRHG = CVLayer(RHG, delta=0.1, p_swap=0.5)
CVRHG.apply_noise()

This had the effect of labelling half the lattice (on average) with GKP states and the other half with p-squeezed states. Then, a Gaussian random noise model was applied with a squeezing parameter of 0.1 to the states in the lattice. Finally, a syndrome measurement (sequence of homodyne measurements) was conducted on the lattice, with the outcomes translated to bit values.

At this point, we are ready to perform error correction on the code and print a message identifying success or failure:

c = correct(RHG)
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.

We also have a #flamingpy channel on the Xanadu Slack, GitHub Discussion Pages, and a Discussion Forum, all great places to start a general discussion and connect with our community members.

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.10.1b1-cp310-cp310-win_amd64.whl (196.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

flamingpy-0.10.1b1-cp310-cp310-manylinux1_x86_64.whl (196.3 kB view details)

Uploaded CPython 3.10

flamingpy-0.10.1b1-cp310-cp310-macosx_10_15_x86_64.whl (186.6 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

flamingpy-0.10.1b1-cp39-cp39-win_amd64.whl (196.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

flamingpy-0.10.1b1-cp39-cp39-manylinux1_x86_64.whl (196.2 kB view details)

Uploaded CPython 3.9

flamingpy-0.10.1b1-cp39-cp39-macosx_10_15_x86_64.whl (186.7 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

flamingpy-0.10.1b1-cp38-cp38-win_amd64.whl (196.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

flamingpy-0.10.1b1-cp38-cp38-manylinux1_x86_64.whl (195.9 kB view details)

Uploaded CPython 3.8

flamingpy-0.10.1b1-cp38-cp38-macosx_10_15_x86_64.whl (186.7 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

Details for the file flamingpy-0.10.1b1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 259854f3b25e6c69700152262460d84f70fae518eadb42b68acb968879d4ced1
MD5 5aeb69f85b76ff1818917706ceac256a
BLAKE2b-256 eb5259cd265ce541053f971295c5d80364abc0cca14ffa2bbc8c56a0b103f41d

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5052fcb9100126c916c7cfe5cf2e83bc5e3a57a87d8307cc9d8896cbbf021333
MD5 2b11ba3b4b15859c6146c015ad5d70dd
BLAKE2b-256 42ebfdc56864e01a6be46321d2c51840a465d9567bc8f5bfc68dd3dd4d6fcc93

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 485001005b135a445ca42faa530cb3cd84524278923c31ecc59c28baab4320bb
MD5 375f5f72008b5d691614aa335fecf92c
BLAKE2b-256 dce395c32ec77fb2fa53f29643a0d74d3af373dc78dd338629633264a1a1ecb2

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3d883ffddd113e0c554a7c97da4578a130531a2e0f5a69a4518df28847fcf935
MD5 fb1142c06411721a43303da9786aec8c
BLAKE2b-256 d71a4fd243ccd5a564c518600ea9471d5d6eedb8474522efa2fe0ff702fe258e

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f0ba85a818f5ac69e72f0801ffcfdc3443b3d4b90fe7f912a65dc0843f9eae8e
MD5 a616eee6ae63ad8c15afabf443b40b32
BLAKE2b-256 4ac54c7c51e03ebc8a94bc9c9baaeabe68245606239398c75c5cef6385610216

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 347861072fe0f4c5271ed537b5c153e690b2164d08eae3e9e27d45d723096926
MD5 5b3c6708fa31bc31ec873c3ff7fd7f07
BLAKE2b-256 f6aaf930e0bcaeec85268569a2c8804f495a11f6bd026857627953f4bd398c66

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c76ec4f23eba3e4407f5851e9457cb796a1c5f79389d888030b3da9940895cd0
MD5 650cafc80aa14072df4ef48eb45f4f13
BLAKE2b-256 e582350ecfe51cb1d0234df467d606f556ae83e2db52fb06a302a8578a4e65cd

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 be11fb1135b56ca3e63ac824f62953cbe148ae21c5a2254e058426df0c2ea909
MD5 06094a0ba19dda9373ee3e8c36e2b9da
BLAKE2b-256 d0b101f8dfbbcbda4a7569a90d8ae6a687f275c2b39c013ae858922d34bfcc05

See more details on using hashes here.

File details

Details for the file flamingpy-0.10.1b1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.10.1b1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 bbc78746626fa74a9b2f598fd32dbe2646c9dfe15a95bf75a46d05f3ccc6d7a1
MD5 eb83dfea82953fd576afa21db2f652bb
BLAKE2b-256 89838f383fd2b08850c6cc3274212942dc36f911d9b5d6f348a1868e0ef34df3

See more details on using hashes here.

Supported by

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