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 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, 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.7.0a4-cp310-cp310-win_amd64.whl (203.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

flamingpy-0.7.0a4-cp310-cp310-manylinux1_x86_64.whl (204.0 kB view details)

Uploaded CPython 3.10

flamingpy-0.7.0a4-cp310-cp310-macosx_10_15_x86_64.whl (192.1 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

flamingpy-0.7.0a4-cp39-cp39-win_amd64.whl (203.2 kB view details)

Uploaded CPython 3.9 Windows x86-64

flamingpy-0.7.0a4-cp39-cp39-manylinux1_x86_64.whl (202.3 kB view details)

Uploaded CPython 3.9

flamingpy-0.7.0a4-cp39-cp39-macosx_10_15_x86_64.whl (192.2 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

flamingpy-0.7.0a4-cp38-cp38-win_amd64.whl (203.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

flamingpy-0.7.0a4-cp38-cp38-manylinux1_x86_64.whl (201.9 kB view details)

Uploaded CPython 3.8

flamingpy-0.7.0a4-cp38-cp38-macosx_10_15_x86_64.whl (191.8 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

Details for the file flamingpy-0.7.0a4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 db34a3f058d6900d2c8d1668f08117eb9244df10ea1fb5c4a181af293540de8b
MD5 03bfbf166ab23b0181f7dfc04316a424
BLAKE2b-256 f084d914bbb9bbf1d16a9ad2010b1823cf74b0cdf0e34fc1a5aec24ef889d960

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e54d30e2bf962764d9fe884703122f98cdd4c6ca3189f2353a6876f3db49c592
MD5 52e77c8495388ef9fa22bb1bcabfcc3b
BLAKE2b-256 d036b406a993c1daf0133ab30b46f9089de540e24a33562f497d3d1ccbaaf407

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 348ed8b970e29c5269252028fc0150ed2031ad07bc289fe53b6446bdceca16d6
MD5 be5650cba80f235eaefa97f7f0d41be3
BLAKE2b-256 ab66ea0b6c52cae008208f66a30c97c07ab0869265228592ccde99293bc7efa6

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 12792a91bc32cd27d0b1aa0a4d322ec7164d4cd14e9c85e4a9677477c6343714
MD5 4c16f8f360b2560b1fd3595693a76e00
BLAKE2b-256 abf82c071011008a0d1197f82588a98e30984bace8d999501fabb1edf2aa0ce4

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e3a5a894f48191aee7602e8e089b7129522f06dd9db8e96d968b3e5fc60792e0
MD5 d74f01cb8675c3556009348a2395cafa
BLAKE2b-256 285134f131bb7c3c91e4444091979028407fc8179f607d02641e3d21c632677a

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a50e100a53a6b11d2e80d83c67609fb4ffd7f93c6b1355ff17f4de77fd166c9d
MD5 c37bf36676baa1ae3369b6f9e58112b2
BLAKE2b-256 12c6065f2dfae18ee31cd526951329af4df87d64243b94a6f99a11510c3d4911

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d86e821fb74aa7fdea3103f61e7cbc9b31cffa65d02db27db5ac21d3fc5ab3ee
MD5 65687ddbf30d1f44739a89d7acb84a5d
BLAKE2b-256 3a7534fd5ef230a7c1001dcd5c56322b1da13043dcf545d4ee1172de94b39afb

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c3b0527ea7eb6e2d86325a5dd97e3c05bdb8898e73eadd359dada3f36d94eb52
MD5 9502c54eefe73e939d6967d1de21a3a3
BLAKE2b-256 69899f0d6d2a0ea272294b64eb83769a819d42fe5b8e816e430b82c7c14cc76e

See more details on using hashes here.

File details

Details for the file flamingpy-0.7.0a4-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.7.0a4-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d51406d1255b9ec42f07b37844a98ba73449aee97ef9cddee4e58cae4ff32a67
MD5 33ca1688001a89f49036b639e7083bfe
BLAKE2b-256 1eb8ac28566491b67600849c721676e0190a47c7e9e5c7e08ddc8ee516fc9177

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