-
Notifications
You must be signed in to change notification settings - Fork 603
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
Fix TrotterProduct fail for a Hamiltonian with identical coefficients #5073
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5073 +/- ##
==========================================
- Coverage 99.69% 99.68% -0.01%
==========================================
Files 394 394
Lines 36073 35806 -267
==========================================
- Hits 35962 35694 -268
- Misses 111 112 +1 ☔ 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.
Pending passing all the GitHub tests, it looks great and It works correctly
[sc-54033] |
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.
I suggest a slightly different solution to preserve the interface.
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.
💯
) [sc-55330] See also PR #5073 and Issue #5066 . Sometimes `qml.dot` was returning a scalar product between a single coefficient and a sum, instead of returning a sum. `TrotterProduct` was not able to handle this sort of nested operator. While we should also make our code more flexible in handling nested operators, we can also standardize the return of `qml.dot`.
…nnyLaneAI#5143) [sc-55330] See also PR PennyLaneAI#5073 and Issue PennyLaneAI#5066 . Sometimes `qml.dot` was returning a scalar product between a single coefficient and a sum, instead of returning a sum. `TrotterProduct` was not able to handle this sort of nested operator. While we should also make our code more flexible in handling nested operators, we can also standardize the return of `qml.dot`.
Context:
Fixes this bug. The input hamiltonian in
TrotterProduct
is internally converted to aSum
. But a Hamiltonian with identical coefficients (=! 1) created internally withqml.dot(coeffs, ops)
has typeSProd
and gives an error.Description of the Change:
The following addition to
TrotterProduct
fixes the issue:Benefits:
Possible Drawbacks:
Related GitHub Issues: