XanaduAI / MrMustard

A differentiable bridge between phase space and Fock space
https://mrmustard.readthedocs.io/
Apache License 2.0
78 stars 27 forks source link

Adding QuadratureEigenstate #437

Closed kaspernielsen96 closed 3 months ago

kaspernielsen96 commented 4 months ago

Context: Adding the quadrature eigenstate Description of the Change: Adding triple, state and tests

codecov[bot] commented 4 months ago

Codecov Report

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

Project coverage is 88.75%. Comparing base (d1a2f5a) to head (9191cdd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #437 +/- ## =========================================== + Coverage 88.70% 88.75% +0.05% =========================================== Files 99 100 +1 Lines 6959 6982 +23 =========================================== + Hits 6173 6197 +24 + Misses 786 785 -1 ``` | [Files](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) | Coverage Δ | | |---|---|---| | [mrmustard/lab\_dev/states/\_\_init\_\_.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fstates%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvc3RhdGVzL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | | [mrmustard/lab\_dev/states/quadrature\_eigenstate.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fstates%2Fquadrature_eigenstate.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvc3RhdGVzL3F1YWRyYXR1cmVfZWlnZW5zdGF0ZS5weQ==) | `100.00% <100.00%> (ø)` | | | [mrmustard/physics/triples.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?src=pr&el=tree&filepath=mrmustard%2Fphysics%2Ftriples.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL3BoeXNpY3MvdHJpcGxlcy5weQ==) | `100.00% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?dropdown=coverage&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/MrMustard/pull/437?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Last update [d1a2f5a...9191cdd](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/437?dropdown=coverage&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 4 months ago

I've noticed a bug:

q0 = QuadratureEigenstate([0], x=0, phi=0);
np.linalg.norm(q0.fock(100))
#  1.7818953913923246

it depends on hbar, so probably there's a missing or extra one

kaspernielsen96 commented 4 months ago

@ziofil regarding the hbar, if we remove the hbar^-1/4 from c then the fock amplitudes no longer depends on the value of hbar. Do you think that is the right solution?