Closed PatrickHuembeli closed 2 years ago
Hi Patrick. Thanks for the PR and I agree that you have the right idea to functionalize the rotations of RotZ in as RotX and RotY are in order to fix the gradient problem, but it looks like the nosetests are failing with logical errors in your update.
At a quick glance, looks like a sign/complex number issue, if you'd like to check the functional form I've always really liked this document by Ian Glendinning (e.g., slide 26): https://www.researchgate.net/profile/Ian-Glendinning/publication/268270479_The_Bloch_Sphere/links/54bf7bc30cf2f6bf4e04f133/The-Bloch-Sphere.pdf
More efficient/precise would probably be writing the z-rotation in the second functional form as a single matrix, like it was written before but now functionalized properly as you have pointed out.
Hi Taylor, Sorry for that. I didn't realize that you absorbed the -1j factor into the Paulies. I added this now. So the PauliZ matrix is [[-1j, 0], [0, 1j]]. With the given convention this should return the right unitaries.
Merging #4 (0ccc2dd) into main (8b13a64) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #4 +/- ##
=======================================
Coverage 97.60% 97.60%
=======================================
Files 20 20
Lines 1545 1548 +3
=======================================
+ Hits 1508 1511 +3
Misses 37 37
Impacted Files | Coverage Δ | |
---|---|---|
tlquantum/tt_gates.py | 99.11% <100.00%> (+0.01%) |
:arrow_up: |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Hey there, The way RotZ was implemented it didn't have any gradient. I fixed the issue by using the same template as for the RotY and RotX. I think the tl.tensor() in the original version somehow blocked the backprop. The way it is written now the gradient is correct.