XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
747 stars 186 forks source link

Add n-mode gaussian transformation gate in TFbackend #599

Closed sylviemonet closed 2 years ago

sylviemonet commented 3 years ago

This is the work to add an n-mode gaussian transformation gate (class Ggate) basing on TFbackend, with my supervisor @ziofil and with the help of @nquesada.

The main idea is to create the n-mode gaussian gate from its (S,d) parameters [Symplectic matrix and displacement vector] to its (C, mu, Sigma) parameters and then get the matrix of gate recursively.

[Warning:] This gate has a special optimizer.

This gate haven't finished the decomposition part.

sylviemonet commented 3 years ago

Can not pass the tests because it can not import the function from TW for now.

codecov[bot] commented 3 years ago

Codecov Report

Merging #599 (e1a90cb) into master (688ac9f) will decrease coverage by 0.01%. The diff coverage is 98.32%.

@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
- Coverage   98.57%   98.56%   -0.02%     
==========================================
  Files          77       77              
  Lines        8999     9178     +179     
==========================================
+ Hits         8871     9046     +175     
- Misses        128      132       +4     
Impacted Files Coverage Δ
strawberryfields/compilers/fock.py 100.00% <ø> (ø)
strawberryfields/backends/tfbackend/ops.py 98.14% <98.13%> (-0.01%) :arrow_down:
strawberryfields/backends/tfbackend/__init__.py 75.00% <100.00%> (+1.66%) :arrow_up:
strawberryfields/backends/tfbackend/backend.py 100.00% <100.00%> (ø)
strawberryfields/backends/tfbackend/circuit.py 96.44% <100.00%> (+0.03%) :arrow_up:
strawberryfields/ops.py 98.87% <100.00%> (-0.13%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 688ac9f...e1a90cb. Read the comment docs.

sylviemonet commented 3 years ago

Hi Filippo @ziofil, could you give a last look at this PR? I think that things are all good on this one.

nquesada commented 3 years ago

@sylviemonet : don't forget to update the CHANGELOG before merging.

nquesada commented 3 years ago

Also, @sylviemonet , seems like the CodeFactor bot is not happy about a couple of minor things.

sylviemonet commented 3 years ago

Also, @sylviemonet , seems like the CodeFactor bot is not happy about a couple of minor things.

Hi @nquesada Nico, I'm really confused with CodeFactor's issue. The first one is the part that I haven't touched... The second one is about the docstring... Compared with other functions at the same level as gaussian_gate (e.g. two_mode_squeezing, kerr_interaction...), they do not have the docstring either, so I don't know if I need to add that..

nquesada commented 3 years ago

Ahh, ok, no worries. Sometimes the bots are not so smart.

nquesada commented 3 years ago

Hi @sylviemonet : I suspect you will need to add a few more test to add coverage to the new functionality you implemented. See for example: image

You can see the breakdown of the coverage by following the detail links in front of codecov/project below