Closed shreyapkumar closed 4 years ago
Possible reviewers could be @lneuhaus , @nquesada and/or @ishdhand
Merging #363 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #363 +/- ##
=======================================
Coverage 97.77% 97.77%
=======================================
Files 52 52
Lines 6435 6435
=======================================
Hits 6292 6292
Misses 143 143
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 4844687...4844687. Read the comment docs.
@shreyapkumar, by the way, CodeFactor runs some static analysis on the PR, and picked up the following issues. Running the Black formatter locally should automatically fix most of them,
black -l 100 strawberryfields/decompositions.py
and the remainder can be fixed by hand.
CodeFactor found multiple issues last seen at 2fa0b43f300d92bae13c9424d1add9346de1e570:
strawberryfields\decompositions.py:499
if U[n, m] == 0 :
^
strawberryfields\decompositions.py:541
strawberryfields\decompositions.py:493 strawberryfields\decompositions.py:654 strawberryfields\decompositions.py:661 strawberryfields\decompositions.py:492 strawberryfields\decompositions.py:548 strawberryfields\decompositions.py:500
if U[m, n] == 0 :
^
Documentation and formatting changes are fixed now. Comments about this or anything else are welcome!
Thanks so much, @josh146 for the very helpful comments! I learnt a lot :)
@shreyapkumar, is this ready to be merged in?
Yes, nothing more to add from my side!
Context: This PR attempts to remove needless complications in the code arising from the difference between how theorists define T matrices and the equivalent transformations that the chip implements.
Currently, the unitary is decomposed into Clements T matrices which are later converted to phases on the chip by
rectangular_symmetric
function. Decomposing the unitary directly into Mach Zehnder units would make the code simpler. It would also make it easier to modify the code and decompositions as planned in order to account for imperfect beamsplitters and also for power reduction, etc.Description of the Change:
MZ
matrices to eventually replaceT
matrices to now represent the units on the chip.rectangular_symmetric
by modifyingrectangular_phase_end_MZ
to directly calculate internal and external phases on chip.Possible Drawbacks: