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
Added a warning to ApproxTimeEvolution documentation #5137
Conversation
…lent hamiltonian objects
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5137 +/- ##
==========================================
- Coverage 99.69% 99.68% -0.01%
==========================================
Files 394 394
Lines 36118 35846 -272
==========================================
- Hits 36007 35734 -273
- 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.
Thanks @jackyruth!
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5137 +/- ##
==========================================
- Coverage 99.68% 99.68% -0.01%
==========================================
Files 396 396
Lines 36640 36368 -272
==========================================
- Hits 36526 36253 -273
- Misses 114 115 +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.
Thanks @jackyruth! Approved, once my comments are resolved.
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
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.
Hi @jackyruth,
Thanks for the addition! Indeed you are correct, but actually the source of this is a result of the fundamental theory of the Trotter decomposition, which is what is underlying the implementation of ApproxTimeEvolution
.
My suggestion would be to rephrase the warning so that it's clear that this divergent behaviour comes from theory and not as a result of the code specifically. Try something like this:
Warning: The Trotter decomposition depends on the order of terms summed together
in the Hamiltonian. Mathematically identical, but re-ordered, hamiltonians will
produced different time evolutions in certain parameter regimes.
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.
Thanks 💯 !
Thanks @jackyruth! We often tag contributors in our release marketing on Twitter/X. If you would optionally like to be tagged, please could you share your username? |
Hi Thomas!
Thanks so much for reviewing my first pull request.
I would like to be tagged under the username @jackyruth
<https://github.com/jackyruth>
Cheers,
Jacky Jiang
…On Wed, Feb 21, 2024 at 7:47 AM Thomas R. Bromley ***@***.***> wrote:
Thanks @jackyruth <https://github.com/jackyruth>!
We often tag contributors in our release marketing on Twitter/X. If you
would optionally like to be tagged, please could you share your username?
—
Reply to this email directly, view it on GitHub
<#5137 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHXKYPSWGXA5FUAAFPPLM5TYUYJHXAVCNFSM6AAAAABCUE64CGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXGAYTMNRXGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Context:
Two mathematically equal Hamiltonians
H1
andH2
pass all the usual equality checks.But lead to different time evolutions under
qml.ApproxTimeEvolution
, due to the order in which the observables are stored inqml.Hamiltonian
.This is a tricky scenario that may confuse many users, so it's prudent to add a warning to the
qml.ApproxTimeEvolution
documentation.Description of the Change:
Before
After
Benefits:
Save a few hours of debugging for users who are mislead by the "equality" of the hamiltonians.
Possible Drawbacks:
(Slightly) longer
qml.ApproxTimeEvolution
documentation.Related GitHub Issues:
#5092
Related Shortcut Stories:
[sc-55193]
Fixes #5092.