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
Return qchem Hamiltonians with real dtype coeffs #4639
Conversation
Hello. You may have forgotten to update the changelog!
|
[sc-44462] |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4639 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 376 376
Lines 33672 33678 +6
=======================================
+ Hits 33548 33554 +6
Misses 124 124
☔ View full report in Codecov by Sentry. |
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.
Right now tol=0
behaves the same as tol=None
; I would expect tol=0
to remove complex terms that were exactly 0, so I think this should be updated.
I guess it's being indirectly tested through the observable_hf
test file, but could we add a small test explicitly testing just this for tol of None
, 0
, and something small? Something that would catch the current behaviour where 0 is treated as None.
Also needs a changelog entry :)
I second Lillian's sentiment - keeping the default to |
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Added the test and 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.
🎉
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.
🚀
Context:
The qchem Hamiltonians built with the new
qml.jordan_wigner
function have complex coefficients with zero imaginary components. This PR removes the imaginary part if it is less than a pre-defined tolerance.Description of the Change:
The
qml.jordan_wigner
function is modified to optionally remove the imaginary components of the computed qubit operator.Benefits:
Possible Drawbacks:
Related GitHub Issues: