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_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.

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.9.0b0-cp310-cp310-win_amd64.whl (200.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

flamingpy-0.9.0b0-cp310-cp310-manylinux1_x86_64.whl (201.3 kB view details)

Uploaded CPython 3.10

flamingpy-0.9.0b0-cp310-cp310-macosx_10_15_universal2.whl (190.0 kB view details)

Uploaded CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64)

flamingpy-0.9.0b0-cp39-cp39-win_amd64.whl (201.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

flamingpy-0.9.0b0-cp39-cp39-manylinux1_x86_64.whl (201.8 kB view details)

Uploaded CPython 3.9

flamingpy-0.9.0b0-cp39-cp39-macosx_10_15_x86_64.whl (190.9 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

flamingpy-0.9.0b0-cp38-cp38-win_amd64.whl (200.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

flamingpy-0.9.0b0-cp38-cp38-manylinux1_x86_64.whl (201.7 kB view details)

Uploaded CPython 3.8

flamingpy-0.9.0b0-cp38-cp38-macosx_10_15_x86_64.whl (190.8 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

Details for the file flamingpy-0.9.0b0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3e538865f6b1145bf28a019ffae67c839017802a6379bab47eab18b3fe184596
MD5 773b45597e44813f07f93c92d377ab06
BLAKE2b-256 a4913441b9937fd83febf5df1e315f63eca9562c3b6c7fa92268b00ecdb8c154

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1711541ad1fc2c6f424e386cdf4fb267bdb8d1f0ac5832126d61cc4df10d3770
MD5 4b39c0fdf524ce5ae4f3a60bcfaa16f8
BLAKE2b-256 ca82c6d7ac106af4895e500db150839f29c76cee6f76968b564fa7bb4d1924c0

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp310-cp310-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 f76e80019e4ae8ca62bbe5db18733f1af5b16e1c9ba8515aa9f3ce13ed4232d0
MD5 b2b62911ba1c3912ffcb94ad447c6a3f
BLAKE2b-256 0a5b31de0bcadfa3aff5e44416b672dff26642c02d1415257fd2b059a88dce3f

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 809e939537d4d794702b12cd5a76218ad70f3b6bcd124eb45406c14ec6a746d9
MD5 67728c4766c9fc15ca5f09f6b0c6c877
BLAKE2b-256 11ddcd2ad670568f32c719209afa16a747f252354736d6af8fb4c4cca1ed4a77

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cf3d38e0497a7fc6d00b917899e5360a49658f7854d33c1080cac7083dabaa95
MD5 c76f0820369095a0b638aced8671b658
BLAKE2b-256 aa3773e845984d7df70ecf6bd7c721f5ca0e26a3c0652084cc958252ff99f632

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8ad690800263244d053ee01c71638a5e028ca767fe44400e6cba465c62702911
MD5 24a57963e0d32b3be7dfe252f9222171
BLAKE2b-256 d2114857ddfc8b0dbc8b3b93e74278517a065a37621d46bd6fdac11b67429e4b

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 16519932568cd426959c2f06e0ed1de110abefab7e42f0d9da64c87210a273ce
MD5 a8cc02ac2371b78045dc6860515e0c23
BLAKE2b-256 02873b9a376d3cfa731c85f2c45660cd752548ddcd288719784bb3b593b47d42

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dcf386da55db4d5092049821e6810c918fcd5d507f1869bb04aa2410f54ff0e7
MD5 82c418f7522a0057a15a69ac99e247c7
BLAKE2b-256 293324796f9567781f0da110cbd09dd0d8a33b1da908eb509de31e80061a1038

See more details on using hashes here.

File details

Details for the file flamingpy-0.9.0b0-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for flamingpy-0.9.0b0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5c77b1bace3d3af9b54e6dffe6f4f029fdcbb49e08e2c42a89ce533eeb957130
MD5 d6df0b2fc25b66dbaf7aa5944345fa68
BLAKE2b-256 4c9995927844b6d6a5dcccaebe6dac3b6450040d58421fbbada5d9d82f69b40d

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