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

Better blochmessiah #381

Closed nquesada closed 5 months ago

nquesada commented 5 months ago

A simpler faster implementation of Bloch Messiah

About 2x in speed for N=10 modes:

image

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6247fc8) 100.00% compared to head (294c745) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #381 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 28 28 Lines 1964 1956 -8 ========================================= - Hits 1964 1956 -8 ``` | [Files](https://app.codecov.io/gh/XanaduAI/thewalrus/pull/381?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) | Coverage Δ | | |---|---|---| | [thewalrus/decompositions.py](https://app.codecov.io/gh/XanaduAI/thewalrus/pull/381?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL2RlY29tcG9zaXRpb25zLnB5) | `100.00% <100.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/XanaduAI/thewalrus/pull/381?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/XanaduAI/thewalrus/pull/381?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Last update [6247fc8...294c745](https://app.codecov.io/gh/XanaduAI/thewalrus/pull/381?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI).
ziofil commented 5 months ago

are these functions numbifiable?

nquesada commented 5 months ago

What does that mean?

sduquemesa commented 5 months ago

@nquesada numbifiable: meaning you can use numba (usually the @numba.njit decorator) to compile and speed up the function.

@ziofil this functions use scipy's schur, sqrtm, and polar which are not supported by numba (i.e., not numbifiable).

nquesada commented 5 months ago

Thanks for the review @sduquemesa