XanaduAI / thewalrus

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.
https://the-walrus.readthedocs.io
Apache License 2.0
99 stars 54 forks source link

the Bristolian #316

Closed jakeffbulmer closed 2 years ago

jakeffbulmer commented 2 years ago

Context: matrix functions for calculating threshold detector statistics of Fock states interfering in linear optical interferometers.

Description of the Change: New functions, the "Bristolian" brs and the "Unitary Bristolian" ubrs are added to _permanent.py and imported in __init__.py.

Benefits: Allows for calculation of threshold detector statistics in experiments where Fock states are interfered in linear optical interferometers.

There are also new functions in _permanent.py called fock_threshold_prob and fock_prob which make it easy to get the probabilities of Fock state interference in linear optics. These latter functions are not imported in the init file, but maybe they could be useful elsewhere?

Possible Drawbacks: What could possibly go wrong?

Related GitHub Issues:

codecov[bot] commented 2 years ago

Codecov Report

Merging #316 (6a7c1a6) into master (4ae3408) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #316   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         1575      1603   +28     
=========================================
+ Hits          1575      1603   +28     
Impacted Files Coverage Δ
thewalrus/__init__.py 100.00% <100.00%> (ø)
thewalrus/_permanent.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4ae3408...6a7c1a6. Read the comment docs.

nquesada commented 2 years ago

Almost there @jakeffbulmer : you just need a test for the branching here:

image

You can likely parametrize one of the test you wrote...

nquesada commented 2 years ago

Thanks @sduquemesa