XanaduAI / thewalrus

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

new torontonian sampling #248

Closed jakeffbulmer closed 3 years ago

jakeffbulmer commented 3 years ago

Context: the old torontonian sampling function using tor, and so could not be used for states with displacement. It was also a little clumsy.

Description of the Change: The function now calls threshold_detection_prob, making the code a bit cleaner and importantly also allows for displaced Gaussian states to be sampled from.

Benefits: Cleaner code, nonzero displacement now allowed.

Possible Drawbacks: We could do some clever things to speed it up slightly.

Related GitHub Issues:

codecov[bot] commented 3 years ago

Codecov Report

Merging #248 (dfdaa89) into master (1328305) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #248   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         1263      1260    -3     
=========================================
- Hits          1263      1260    -3     
Impacted Files Coverage Δ
thewalrus/samples.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 1328305...dfdaa89. Read the comment docs.