Skip to main content

A simulator for photonic quantum computations.

Project description

Piquasso logo

Coverage License Issues Pull requests Tests

Piquasso is an open-source Python library for simulating photonic quantum computers.

This is a research project, bugs can be expected. If you encounter any, please report it in the Issues page.

Basic example

import numpy as np
import piquasso as pq

with pq.Program() as program:
    pq.Q(0) | pq.Displacement(
        r=np.sqrt(2), phi=np.pi / 4
    )  # Displace the state on mode 0.
    pq.Q(0, 1) | pq.Beamsplitter(
        theta=0, phi=np.pi / 2
    )  # Use a beamsplitter gate on modes 0, 1.

    pq.Q(0) | pq.ParticleNumberMeasurement()  # Measurement on mode 0.

simulator = pq.GaussianSimulator(
    d=3, config=pq.Config(hbar=2)
)  # Prepare a Gaussian vacuum state

result = simulator.execute(program, shots=10)  # Apply the program with 10 shots.

print("Resulting state:", result.state)
print("Detected samples:", result.samples)

This code outputs:

Resulting state: <piquasso._simulators.gaussian.state.GaussianState object at 0x7f3ef3604ac0>
Detected samples: [(0,), (2,), (1,), (2,), (2,), (4,), (1,), (1,), (4,), (1,)]

For more details, please refer to the Piquasso documentation.

Install

Piquasso and its dependencies can be installed via pip:

pip install piquasso

If you have problems installing Piquasso as above, try installing from source with

pip install --no-binary piquasso

When installing from source does not work on your machine, please open an issue in the Issues page.

If you wish to, you can also install piquassoboost for performance improvement.

If you are doing research using Piquasso, please cite us as follows:

@misc{piquasso2024,
  title         = {Piquasso: A Photonic Quantum Computer Simulation Software Platform},
  author        = {Z. Kolarovszki and
                   T. Rybotycki and
                   P. Rakyta and
                   Á. Kaposi and
                   B. Poór and
                   Sz. Jóczik and
                   D. T. R. Nagy and
                   H. Varga and
                   K. H. El-Safty and
                   G. Morse and
                   M. Oszmaniec and
                   T. Kozsik and
                   Z. Zimborás
                   },
  year          = {2024},
  eprint        = {2403.04006},
  archiveprefix = {arXiv},
  primaryclass  = {quant-ph}
}

Documentation

The documentation is avaliable at https://piquasso.readthedocs.io/.

How to contribute?

We welcome people who want to make contributions to Piquasso, be it big or small! If you are considering larger contributions to the source code, please contact us first.

We also appreciate bug reports, suggestions, or any kind of idea regarding Piquasso.

Development guide

To install development dependencies, use:

pip install -e ".[dev]"

For document generation one should use

pip install -e ".[docs]"

and for running files under benchmarks/ or scripts/, please issue

pip install -e ".[benchmark]"

For building Piquasso, one also needs to install build dependencies:

pip install 'pybind11[global]' scikit-build-core cmake

To build Piquasso for local development, run

cmake -B build -DCMAKE_INSTALL_PREFIX=$(pwd)
cmake --build build
cmake --install build

Here, the -DCMAKE_INSTALL_PREFIX=$(pwd) flag is needed to copy shared libraries into the source tree for development.

Testing

Tests and additional checks can be run using tox. After installation, run the following command:

tox -e py312

Alternatively, you can run only the tests using pytest. After installation, run the following command:

pytest tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piquasso-5.0.0.tar.gz (607.2 kB view hashes)

Uploaded Source

Built Distributions

piquasso-5.0.0-pp310-pypy310_pp73-win_amd64.whl (251.8 kB view hashes)

Uploaded PyPy Windows x86-64

piquasso-5.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (282.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

piquasso-5.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl (244.0 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

piquasso-5.0.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl (254.4 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

piquasso-5.0.0-pp39-pypy39_pp73-win_amd64.whl (251.7 kB view hashes)

Uploaded PyPy Windows x86-64

piquasso-5.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.3 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (282.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

piquasso-5.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl (244.0 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

piquasso-5.0.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl (254.3 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

piquasso-5.0.0-pp38-pypy38_pp73-win_amd64.whl (251.9 kB view hashes)

Uploaded PyPy Windows x86-64

piquasso-5.0.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.3 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (282.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

piquasso-5.0.0-pp38-pypy38_pp73-macosx_11_0_arm64.whl (244.0 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

piquasso-5.0.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (254.0 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

piquasso-5.0.0-cp312-cp312-win_amd64.whl (253.2 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

piquasso-5.0.0-cp312-cp312-win32.whl (245.9 kB view hashes)

Uploaded CPython 3.12 Windows x86

piquasso-5.0.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

piquasso-5.0.0-cp312-cp312-musllinux_1_2_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

piquasso-5.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (282.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

piquasso-5.0.0-cp312-cp312-macosx_11_0_arm64.whl (244.6 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

piquasso-5.0.0-cp312-cp312-macosx_10_9_x86_64.whl (254.8 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

piquasso-5.0.0-cp311-cp311-win_amd64.whl (253.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

piquasso-5.0.0-cp311-cp311-win32.whl (245.7 kB view hashes)

Uploaded CPython 3.11 Windows x86

piquasso-5.0.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

piquasso-5.0.0-cp311-cp311-musllinux_1_2_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

piquasso-5.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (277.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (282.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

piquasso-5.0.0-cp311-cp311-macosx_11_0_arm64.whl (245.4 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

piquasso-5.0.0-cp311-cp311-macosx_10_9_x86_64.whl (255.6 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

piquasso-5.0.0-cp310-cp310-win_amd64.whl (251.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

piquasso-5.0.0-cp310-cp310-win32.whl (244.7 kB view hashes)

Uploaded CPython 3.10 Windows x86

piquasso-5.0.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

piquasso-5.0.0-cp310-cp310-musllinux_1_2_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

piquasso-5.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (281.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

piquasso-5.0.0-cp310-cp310-macosx_11_0_arm64.whl (244.0 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

piquasso-5.0.0-cp310-cp310-macosx_10_9_x86_64.whl (253.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

piquasso-5.0.0-cp39-cp39-win_amd64.whl (251.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

piquasso-5.0.0-cp39-cp39-win32.whl (244.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

piquasso-5.0.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

piquasso-5.0.0-cp39-cp39-musllinux_1_2_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

piquasso-5.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (281.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

piquasso-5.0.0-cp39-cp39-macosx_11_0_arm64.whl (244.0 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

piquasso-5.0.0-cp39-cp39-macosx_10_9_x86_64.whl (254.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

piquasso-5.0.0-cp38-cp38-win_amd64.whl (251.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

piquasso-5.0.0-cp38-cp38-win32.whl (244.6 kB view hashes)

Uploaded CPython 3.8 Windows x86

piquasso-5.0.0-cp38-cp38-musllinux_1_2_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

piquasso-5.0.0-cp38-cp38-musllinux_1_2_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ i686

piquasso-5.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

piquasso-5.0.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (281.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

piquasso-5.0.0-cp38-cp38-macosx_11_0_arm64.whl (243.8 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

piquasso-5.0.0-cp38-cp38-macosx_10_9_x86_64.whl (253.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

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