A library to help better understand AaronsonArkhipov Boson Sampling (AABS)
Project description
Boson Sampling Library
The following library was developed to better understand AaronsonArkhipov Boson Sampling (AABS) (the acronym "AABS" for the particular Boson Sampling setup was encountered in Kruse et al.'s paper A detailed study of Gaussian Boson Sampling) by simulating the behavior of fock state inputs through a random unitary based linear interferometer and calculating the probabilities of certain fock state ouptuts.
Installation
You can either
pip install bosonsampling
or clone the library and within the directory (as well as having your favorite python environment activate) run the following:
pip install .
Usage

Import
bosonsampling
for core functionality and therandom_interferometer()
function fromstrawberryfields.utils
to set up a random interferometer.import bosonsampling as bs from strawberryfields.utils import random_interferometer

Create your random_interferometer
# creates a 4x4 unitary matrix random_interferometer = random_interferometer(4)

Create your input Fock states
# 0 photons in mode 1 # 1 photon in mode 2 # 3 photons in mode 3 # 4 photons in mode 4 photons_in = [0,1,3,4]

You can either:
a. Measure the probability of a certain output state
photons_out = [0,0,0,8] output_probability = bs.output_probability(photons_in, photons_out, random_interferometer)
b. OR Measure the probability of ALL output states
for photon_out_configuration in bs.gen_output_configurations(sum(photons_in), len(photons_in)): output_probability = bs.output_probability(photons_in, photon_out_configuration, random_interferometer) print("Probability of photon output {0} : {1}".format(photon_out_configuration, output_probability))
Example Files
Example files have been included to explain different possible usages with bosonsampling
and can be found in the examples
folder.
All files prefixed with bs_
are dedicated solely to bosonsampling.py
.
However, there are files prefixed with sf_
that show how identical behavior can be obtained with Strawberry Fields (great for verifying results) and how bosonsampling
can be used in conjunction with it as well.

bs_single_photon_test.py
 demonstrates a single photon entering the interferometer and calculating the probability of all possible outputs 
bs_multiple_photon_test.py
 demonstrates multiple photons entering the interferometer and calculating the probability of all possible outputs, emphasizing howgen_output_configurations()
can come in handy for such scenarios. 
bs_aabs_setup.py
 demonstrates a setup similar to what would be called for in the AaronsonArkhipov paper with a multiple, singlephoton fock state input with the modes right next to eachother and how the probability of detecting a "collision" (an output state that has multiple photons in a single mode) is incredibly low 
bs_aabs_scaling.py
 Is essentially a duplicate ofbs_aabs_setup.py
but has an outer loop designed to make the interferometer larger with each iteration but keeps the number of inputted photons identical so one can observe the decreasing probability of collision. 
sf_single_photon_test.py
 Isbs_single_photon_test.py
but implemented with Xanadu's Strawberry Fields framework 
sf_multiple_photon_test.py
 Isbs_multiple_photon_test.py
but implemented with Xanadu's Strawberry Fields framework.
Contributing
If you find a bug or have an idea to improve the library, please feel free to either make an Issue or a Pull Request with your suggested changes! If you are contributing code, please do note that this library attempts to follow the PEP8 Style Guide for Python Code as well as using Google Style Python Docstrings
Credits
The following resources were used to develop the main functions behind library:
Videos
Quantum Supremacy via Boson Sampling: Theory and Practice  Quantum Colloquium by the Perimeter Institute with Scott Aaronson as the guest speaker.
Provides the formula in the first few minutes for calculating the probability of a certain photon output configuration (although the papers below also have equivalent formulations).
Quantum Complexity Theory: Lecture 9  Boson Sampling by Sevag Gharibian
Provided an excellent explanation of the column and row indexing/copying required to generate a matrix, which is the basis for both the default and memory efficient implementations of the submatrix generator in the library.
Generating integer partitions by Jerome Kelleher
Provided the integer partitioning function which is used to help generate all possible output photon states
in gen_output_configurations()
function
Get all permutations of a numpy array by Bill Bell
Provided a method of using sympy
to generate all unique permutations of a given
numpy array (works with ordinary lists too) and is part of the
gen_output_configurations()
function
Papers
An introduction to bosonsampling by Gard et al.
A detailed study of Gaussian Boson Sampling provided the origin of the AABS acronym used throughout the project and has a very nice illustration on page 2 that describes the column and row indexing necessary to generate the proper submatrix that Sevag Gharibian also goes over.
Websites
Boson sampling and the permanent
provided the basis for code in sf_single_photon_test.py
and sf_multiple_photon_test.py
Additional Resources
These are resources that did not contribute directly to the code but were invaluable in learning more about boson sampling:
Experimental Boson Sampling by Tillman et al.
Introduction to bosonsampling by Peter Rohde
Gaussian Boson Sampling Complexity  Part 1 by Andrew Tanggara
Note: This video was barely consulted, but appred to be very well made and is given by Alex Arkhipov himself! Quantum computing with noninteracting particles  Alex Arkhipov
Project details
Release history Release notifications  RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size  File type  Python version  Upload date  Hashes 

Filename, size bosonsampling1.0.0py3noneany.whl (16.5 kB)  File type Wheel  Python version py3  Upload date  Hashes View 
Filename, size bosonsampling1.0.0.tar.gz (16.4 kB)  File type Source  Python version None  Upload date  Hashes View 
Hashes for bosonsampling1.0.0py3noneany.whl
Algorithm  Hash digest  

SHA256  d3b881ff97f69012188c5e1641788aba61bf40921b8cbf70addb509541e39bb0 

MD5  910a7993f28d34050e285ce81ff0da56 

BLAKE2256  bb7752c6cd34b4220dc08abdc8dff9f627d180c1d0ad8aac61ef736b99cbebec 