-
Notifications
You must be signed in to change notification settings - Fork 575
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
add private helper functions for squaring Hamiltonian terms and colle… #1213
add private helper functions for squaring Hamiltonian terms and colle… #1213
Conversation
…cting duplicate terms, add unit tests
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #1213 +/- ##
=======================================
Coverage 98.13% 98.13%
=======================================
Files 147 147
Lines 11260 11277 +17
=======================================
+ Hits 11050 11067 +17
Misses 210 210
Continue to review full report at Codecov.
|
Thanks @anthayes92! Looks good, could we come up with two minimal working examples that motivate why we need these functions (to be sure it's worth adding them in)? E.g., could we have a simple Hamiltonian This will also help us understand the shortfalls of the current approach in |
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.
Awesome!
In order to evaluate flow constraints of the cost Hamiltonian in the max weighted cycle QAOA problem, we need to reliably expand quadratic terms and simplify the resulting expressions.
Add a private function to find the coefficients and operators of the term of the Hamiltonian to be squared.
Add a private function to collect duplicate terms of a Hamiltonian.
Example of current and desired behaviour:
Using the tensor product operation
@
as currently implemented we find:The desired output of the above example would be:
This may no longer be needed when related issues on Hamiltonian simplification are closed