Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloch Messiah decomposition from The Walrus #729

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sduquemesa
Copy link
Contributor

NOTE: This PR is using thewalrus/main. DO NOT MERGE until there is a new release of The Walrus (don't forget to change the requirement files accordingly).

Context:
The current implementation of the Bloch-Messiah decomposition fails for degenerate symplectic matrices.

Description of the Change:
The Walrus included a new implementation of the Bloch-Messiah decomposition that solves the issue. This PR swaps the
SF implementation for the new improved implementation on TW.

Benefits:
Bloch-Messiah works for degenerate symplectic matrices.

Possible Drawbacks:
None.

Related GitHub Issues:
Closes #728

@sduquemesa sduquemesa added bug Something isn't working do not merge labels Sep 6, 2022
@sduquemesa sduquemesa self-assigned this Sep 6, 2022
@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #729 (720637e) into master (9a9a352) will decrease coverage by 59.45%.
The diff coverage is 66.66%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #729       +/-   ##
===========================================
- Coverage   98.33%   38.88%   -59.46%     
===========================================
  Files          78       78               
  Lines        9603     9578       -25     
===========================================
- Hits         9443     3724     -5719     
- Misses        160     5854     +5694     
Impacted Files Coverage Δ
strawberryfields/decompositions.py 12.88% <66.66%> (-86.57%) ⬇️
strawberryfields/io/xir_io.py 8.04% <0.00%> (-90.23%) ⬇️
strawberryfields/apps/subgraph.py 10.11% <0.00%> (-89.89%) ⬇️
strawberryfields/apps/clique.py 10.67% <0.00%> (-89.33%) ⬇️
strawberryfields/apps/qchem/dynamics.py 12.65% <0.00%> (-87.35%) ⬇️
strawberryfields/backends/tfbackend/ops.py 11.96% <0.00%> (-86.31%) ⬇️
...fields/backends/gaussianbackend/gaussiancircuit.py 13.02% <0.00%> (-86.21%) ⬇️
strawberryfields/backends/tfbackend/states.py 13.33% <0.00%> (-85.65%) ⬇️
strawberryfields/tdm/utils.py 11.60% <0.00%> (-85.64%) ⬇️
strawberryfields/plot.py 13.15% <0.00%> (-85.09%) ⬇️
... and 49 more

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 9a9a352...720637e. Read the comment docs.

@sduquemesa sduquemesa marked this pull request as draft September 6, 2022 20:56
@sduquemesa sduquemesa added the WIP label Sep 7, 2022
@@ -1021,53 +1011,7 @@ def bloch_messiah(S, tol=1e-10, rounding=9):
if np.linalg.norm(np.transpose(S) @ omega @ S - omega) >= tol:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a is_symplectic function in the walrus that you can use directly here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! comments on unmodified lines 🧐

(thanks for the suggestion, will do!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working do not merge WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bloch-Messiah returns incorrect results
2 participants