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

QtoB and other improvements #407

Closed ziofil closed 5 months ago

ziofil commented 5 months ago

Context: We can use the inverse of BtoQ to define a QtoB map. This way the code to initialize from quadrature is drastically simplified, and it can be placed higher in the hierarchy.

Description of the Change: Some methods have been moved up the hierarchy and greatly simplified.

Benefits: Simpler code, more robust.

Possible Drawbacks: More classes

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 98.10127% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.69%. Comparing base (d36cd40) to head (bbf1864).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #407 +/- ## =========================================== + Coverage 87.65% 87.69% +0.03% =========================================== Files 81 81 Lines 6175 6153 -22 =========================================== - Hits 5413 5396 -17 + Misses 762 757 -5 ``` | [Files](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?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/abstract/state.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab%2Fabstract%2Fstate.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYi9hYnN0cmFjdC9zdGF0ZS5weQ==) | `92.66% <ø> (ø)` | | | [mrmustard/lab\_dev/circuit\_components\_utils.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fcircuit_components_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvY2lyY3VpdF9jb21wb25lbnRzX3V0aWxzLnB5) | `100.00% <100.00%> (ø)` | | | [mrmustard/lab\_dev/circuits.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fcircuits.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvY2lyY3VpdHMucHk=) | `95.45% <100.00%> (ø)` | | | [mrmustard/lab\_dev/states/states.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fstates%2Fstates.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvc3RhdGVzL3N0YXRlcy5weQ==) | `100.00% <100.00%> (ø)` | | | [mrmustard/lab\_dev/transformations/base.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Ftransformations%2Fbase.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvdHJhbnNmb3JtYXRpb25zL2Jhc2UucHk=) | `100.00% <100.00%> (ø)` | | | [...mustard/lab\_dev/transformations/transformations.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Ftransformations%2Ftransformations.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvdHJhbnNmb3JtYXRpb25zL3RyYW5zZm9ybWF0aW9ucy5weQ==) | `100.00% <100.00%> (ø)` | | | [mrmustard/lab\_dev/utils.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvdXRpbHMucHk=) | `91.66% <ø> (ø)` | | | [mrmustard/physics/fock.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Fphysics%2Ffock.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL3BoeXNpY3MvZm9jay5weQ==) | `92.23% <ø> (ø)` | | | [mrmustard/lab\_dev/states/base.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fstates%2Fbase.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvc3RhdGVzL2Jhc2UucHk=) | `96.55% <96.42%> (+0.09%)` | :arrow_up: | | [mrmustard/lab\_dev/circuit\_components.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?src=pr&el=tree&filepath=mrmustard%2Flab_dev%2Fcircuit_components.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL2xhYl9kZXYvY2lyY3VpdF9jb21wb25lbnRzLnB5) | `98.14% <97.10%> (+1.89%)` | :arrow_up: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?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/407?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Last update [d36cd40...bbf1864](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/407?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).