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

Total clicks #348

Closed ajmartinezc closed 1 year ago

ajmartinezc commented 1 year ago

Context:

The computation of grouped (total) click probabilities is necessary for running validation tests in the context of Gaussian boson sampling with threshold detectors. Drummond et al. proposed an efficient method to compute these probabilities.

Description of the Change:

The computation of grouped click probabilities, following Drummond's simulation method, is implemented using numba.

Benefits:

The function, which is not implemented in thewalrus, gives a simple way to compute total click probability distributions.

Possible Drawbacks:

In some cases the number of samples needed for convergence may be large, thus increasing the time of computation.

Related GitHub Issues:

nquesada commented 1 year ago

One thing that would be a good idea is to make grouped_click_probabilities part of the quantum module.

codecov[bot] commented 1 year ago

Codecov Report

Merging #348 (3114720) into master (7bc7d97) will not change coverage. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #348 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 25 27 +2 Lines 1853 1891 +38 ========================================= + Hits 1853 1891 +38 ``` | [Impacted Files](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) | Coverage Δ | | |---|---|---| | [thewalrus/\_hafnian.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL19oYWZuaWFuLnB5) | `100.00% <ø> (ø)` | | | [thewalrus/loop\_hafnian\_batch.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL2xvb3BfaGFmbmlhbl9iYXRjaC5weQ==) | `100.00% <ø> (ø)` | | | [thewalrus/loop\_hafnian\_batch\_gamma.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL2xvb3BfaGFmbmlhbl9iYXRjaF9nYW1tYS5weQ==) | `100.00% <ø> (ø)` | | | [thewalrus/samples.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL3NhbXBsZXMucHk=) | `100.00% <ø> (ø)` | | | [thewalrus/fock\_gradients.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL2ZvY2tfZ3JhZGllbnRzLnB5) | `100.00% <100.00%> (ø)` | | | [thewalrus/grouped\_click\_probabilities.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL2dyb3VwZWRfY2xpY2tfcHJvYmFiaWxpdGllcy5weQ==) | `100.00% <100.00%> (ø)` | | | [thewalrus/\_\_init\_\_.py](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-dGhld2FscnVzL19faW5pdF9fLnB5) | `100.00% <0.00%> (ø)` | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?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://codecov.io/gh/XanaduAI/thewalrus/pull/348?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Last update [c19a8c8...3114720](https://codecov.io/gh/XanaduAI/thewalrus/pull/348?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).