Skip to content

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 requested a review from josh146 September 6, 2022 18:51
@sduquemesa sduquemesa self-assigned this Sep 6, 2022
@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.88%. Comparing base (9a9a352) to head (720637e).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
strawberryfields/decompositions.py 66.66% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (9a9a352) and HEAD (720637e). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (9a9a352) HEAD (720637e)
7 1
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     
Files with missing lines Coverage Δ
strawberryfields/decompositions.py 12.88% <66.66%> (-86.57%) ⬇️

... and 57 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sduquemesa sduquemesa marked this pull request as draft September 6, 2022 20:56
@sduquemesa sduquemesa added the WIP label Sep 7, 2022

n = n // 2
omega = sympmat(n)
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