-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Evolved operator functions #13361
Evolved operator functions #13361
Conversation
--> expand should return float | ParameterExpression
some things are still upside down and it seems like it would be cleaner to do the time multiplication inside pauli_evolution
move the x2 multiplication of the rotation angle to Python, where we can pull it together with other floats and minimize the float * Param multiplications
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 11726840442Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
I'm not sure why this fails, the docs build is complaining about
My best guess so far is that it doesn't like that the |
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 think this is in a good shape. Though I would like to take another look after #13295 is merged.
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.
This looks good. I have left a few minor in-place comments and questions.
@Cryoris, one question just came up in a slack discussion with @raynelfss: why do you need the Rust changes at all? I do like the (small) cleanup that moves |
The changes to Rust are artifacts from developing off a non-merged PR 😄 The Rust changes are not needed, I'll revert them. |
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 have a minor comment about the docs.
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'm not too familiar with PauliEvolution or what the evolved_operator_ansatz
tries to achieve specifically but the logic here is sound to me. I'll let @alexanderivrii have the last word on approving, but great job regardless!
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!
let's handle it post rc1, pre actual release
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.
Looks okay, we'll fix the removals with #13407
Summary
Part of #13046: The
evolved_operator_ansatz
andqaoa_ansatz
functions.This is based on #13295, so that PR will need merging first.
Details and comments
After Prepare
PauliEvolutionGate
for Rustiq & port it to Rust #13295, theEvolvedOperatorAnsatz
is already pretty performant since it does the Pauli evolution in Rust. However, with these functions we still gain a speedup since we can do all evolution at once in Rust and don't need go back and forth.This benchmarks the construction of an evolved operator ansatz for an Ising Hamiltonian on a square grid with side length
n
(so
n ** 2
qubits), which has 2 operators; the ZZ-interactions and the X-field. For 100 qubits we get a speedup of 1.33x,which is increasing with the number of qubits (e.g. we get 1.83x at 10'000 qubits).
This also adds a new function called
hamiltonian_variational_ansatz
(HVA), which automatically splits an input Hamiltonian into commuting terms. This is slightly different toevolved_operator_ansatz
, which requires you to manually do this split, but IMO the HVA is the form most users would be interested in. We could've changed the default behavior ofevolved_operator_ansatz
to do the splitting, but I didn't want to change behavior for a class that users are already used to.