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

Faster hermite #280

Closed ziofil closed 2 years ago

ziofil commented 2 years ago

fully numbified filling of termite multitimensional arrays and gradients. It turns out np.ndindex is supported in numba.

nquesada commented 2 years ago

@ziofil --- Could you update the CHANGELOG? Also is this giving a speed increase? If so it would be nice to report it.

ziofil commented 2 years ago

@ziofil --- Could you update the CHANGELOG? Also is this giving a speed increase? If so it would be nice to report it.

Do you have a preferred speed test to compare it against?

nquesada commented 2 years ago

You could run the basic calculation that we use to test the correctness of the numba hermite vs the C++ hermites?

ziofil commented 2 years ago

You could run the basic calculation that we use to test the correctness of the numba hermite vs the C++ hermites?

Sure, where do I find it?

nquesada commented 2 years ago

In the test folder :) in the test_hermite file

ziofil commented 2 years ago

cutoff = 5 and 1,2,3,4,5 indices

Screen Shot 2021-09-02 at 4 25 38 PM
ziofil commented 2 years ago

sped it up a bit

Screen Shot 2021-09-02 at 5 03 03 PM
codecov[bot] commented 2 years ago

Codecov Report

Merging #280 (3bc0dca) into master (e75ade1) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #280   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         1441      1428   -13     
=========================================
- Hits          1441      1428   -13     
Impacted Files Coverage Δ
thewalrus/_hafnian.py 100.00% <100.00%> (ø)
thewalrus/_hermite_multidimensional.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 e75ade1...3bc0dca. Read the comment docs.

josh146 commented 2 years ago

Really nice to see numba defeat C++ :)

🤯 How is Numba able to do this?

ziofil commented 2 years ago

Really nice to see numba defeat C++ :)

🤯 How is Numba able to do this?

probably the C++ code is not well written 😅