-
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
Open
Cryoris
wants to merge
26
commits into
Qiskit:main
Choose a base branch
from
Cryoris:clib/qaoa
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Evolved operator functions #13361
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--> 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
Cryoris
added
performance
Changelog: New Feature
Include in the "Added" section of the changelog
labels
Oct 23, 2024
One or more of the following people are relevant to this code:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.