-
Notifications
You must be signed in to change notification settings - Fork 616
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
Decomposition using GlobalPhase has real phase #4653
Conversation
Hello. You may have forgotten to update the changelog!
|
[sc-44772] |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4653 +/- ##
=======================================
Coverage 99.65% 99.65%
=======================================
Files 376 376
Lines 33702 33702
=======================================
Hits 33585 33585
Misses 117 117
☔ View full report in Codecov by Sentry. |
Sorry if this is WIP, but please add to the changelog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nice and clean :)
This matches #4639 in that they're both attempting to identify real values with dtype=complex. Are they different problems? If everyone needs to set their own thresholds and their own decisions for when to cast, then nvm. But if not, I'd like to standardize how PennyLane deems "approximately real" values to be truly real, and casts them (likely in qml.math). Lmk thoughts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Fixes #4565 |
Context:
When we added the
GlobalPhase
and updated the decompositions forQubitUnitary
to use it, we left the datatype for the phase as complex, even though the results are realDescription of the Change:
There is one line where the angles, though per definition real, need to have a complex dtype to avoid making PyTorch angry. They are now cast to real only there in that line, rather than carrying that through everywhere else.
Benefits:
Its cleaner