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

New poly*exp ansatz #432

Closed kaspernielsen96 closed 3 months ago

kaspernielsen96 commented 4 months ago

Context: Implementing the new poly*exp ansatz. Description of the Change: For now just writing and testing the ansatz, but NOT yet changing the Bargmann representation or anything to use the ansatz. Benefits: Many once implemented

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 95.13889% with 7 lines in your changes missing coverage. Please review.

Project coverage is 88.67%. Comparing base (c483c0e) to head (ac4081a).

Files Patch % Lines
mrmustard/physics/ansatze.py 95.07% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #432 +/- ## =========================================== + Coverage 88.54% 88.67% +0.13% =========================================== Files 98 98 Lines 6799 6940 +141 =========================================== + Hits 6020 6154 +134 - Misses 779 786 +7 ``` | [Files](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI) | Coverage Δ | | |---|---|---| | [mrmustard/math/backend\_manager.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fmath%2Fbackend_manager.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL21hdGgvYmFja2VuZF9tYW5hZ2VyLnB5) | `98.16% <100.00%> (+<0.01%)` | :arrow_up: | | [mrmustard/math/backend\_numpy.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fmath%2Fbackend_numpy.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL21hdGgvYmFja2VuZF9udW1weS5weQ==) | `100.00% <ø> (ø)` | | | [mrmustard/math/backend\_tensorflow.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fmath%2Fbackend_tensorflow.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL21hdGgvYmFja2VuZF90ZW5zb3JmbG93LnB5) | `100.00% <ø> (ø)` | | | [mrmustard/math/lattice/steps.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fmath%2Flattice%2Fsteps.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL21hdGgvbGF0dGljZS9zdGVwcy5weQ==) | `35.00% <ø> (ø)` | | | [mrmustard/math/lattice/strategies/vanilla.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fmath%2Flattice%2Fstrategies%2Fvanilla.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL21hdGgvbGF0dGljZS9zdHJhdGVnaWVzL3ZhbmlsbGEucHk=) | `100.00% <ø> (ø)` | | | [mrmustard/physics/gaussian\_integrals.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fphysics%2Fgaussian_integrals.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL3BoeXNpY3MvZ2F1c3NpYW5faW50ZWdyYWxzLnB5) | `98.44% <ø> (ø)` | | | [mrmustard/physics/ansatze.py](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?src=pr&el=tree&filepath=mrmustard%2Fphysics%2Fansatze.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI#diff-bXJtdXN0YXJkL3BoeXNpY3MvYW5zYXR6ZS5weQ==) | `96.12% <95.07%> (-0.59%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?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/432?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XanaduAI). Last update [c483c0e...ac4081a](https://app.codecov.io/gh/XanaduAI/MrMustard/pull/432?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).
kaspernielsen96 commented 3 months ago

Regarding and and different shapes of c. I add some (ugly) code that can handle that and will add padding zeros (any improvements are more than welcome). Note that the number of not-wires with polynomials must be the same. Otherwise things will start to break down very quickly since this ties into also A and b.

It seems that adding this function makes the ansatz.py file too-complex, so we might have to split the file. This we will anyways have to do when we add call_none to the ansatz.