-
Notifications
You must be signed in to change notification settings - Fork 60
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
Symbolic Hamiltonian fixes #312
Conversation
Codecov Report
@@ Coverage Diff @@
## maxcut #312 +/- ##
==========================================
+ Coverage 99.84% 99.96% +0.12%
==========================================
Files 59 59
Lines 11312 11329 +17
==========================================
+ Hits 11294 11325 +31
+ Misses 18 4 -14
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@stavros11 I think the fix for the trotter may not be working well (see test failure), could you please have a look? |
src/qibo/core/hamiltonians.py
Outdated
constant = self.constant | ||
if set(len(t) for t in terms.keys()) == {1, 2}: | ||
terms = self.merge_one_qubit(terms) | ||
return terms, self.constant |
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 for the update, the issue is here:
return terms, self.constant | |
return terms, constant |
Note that even after this fix there are some numerical issues with the Trotter of the MaxCut and we should set for example atol=1e-12
to make this test pass. This is probably because the construction of the terms within the Trotter introduces a small numerical error and some values that should be 0 become 1e-16
. I don't think it is due to a bug.
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, this works.
Following the discussion in #311, this PR:
SymbolicHamiltonian
to coreK.numeric_types
to intercept scalar symbols