-
Notifications
You must be signed in to change notification settings - Fork 672
Fixed Qdrift test #7621
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
Fixed Qdrift test #7621
Conversation
Hello. You may have forgotten to update the changelog!
|
[sc-91298] |
Since the bug was in the test itself, I think we don't need a changelog entry for this correct? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7621 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 530 530
Lines 52140 52140
=======================================
Hits 51977 51977
Misses 163 163 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thank you so much for fixing this! @Jaybsoni
On the changelog, I guess we can put a note in the internal
part. Usually if it's a very minor fix to test suite or something like typo correction we don't put into changelog atl, but for things like fixing known issues within test suites we still leave a note there.
Also, mind creating a new test to specifically test it with a Hamiltonian that from the very beginning won't allow similar coincidental order reversal atl?
I changed the hamiltonian on line 35 such that its terms no longer commute. Furthermore, the hamiltonian on line 31 also has terms which don't commute. I think this should be sufficient. If we want, we can increase the number of samples (n), this would increase the likelihood of sampling terms which don't commute and would have cause the test to fail sooner. However I don't think it's required anymore. |
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.
LGTM!
Co-authored-by: Yushao Chen (Jerry) <[email protected]>
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.
LGTM!
I don't have anything else to say. I was about to suggest just adding a comment, making sure to use non-commuting terms in the test Hamiltonian, but I see that it is already there.
Thank you!
Context:
Integration tests for the Qdrift template were failing. These tests were comparing the state produced after applying QDrift with the state produced after applying its decomposition.
The source of the discrepancy was a bug in the tests themselves. Specifically, the expected state was produced by multiplying the gates in the expected decomposition of QDrift in the opposite order. The order should be reversed from that of the decomposition.
This should have caused all of the tests to fail initially, however the hamiltonians used while testing Qdrift had accidentally been chosen such that most of their terms commuted with each other. Due to this, the order of the decomposition didn't matter except for the few edge cases.
Description of the Change:
expected_decomp
list