-
Notifications
You must be signed in to change notification settings - Fork 329
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
optimize FidelityQuantumKernel
parameterization
#719
optimize FidelityQuantumKernel
parameterization
#719
Conversation
Can you please measure how faster the implementation becomes with this PR? |
Pull Request Test Coverage Report for Build 7049710944
💛 - Coveralls |
This is the runtime of the respective functions in seconds as benchmarked with
|
Thanks, this is interesting. Can you please additionally measure an overall impact on |
With
|
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.
So, performance gain is not that large on a decent number of qubits, but still there is.
Co-authored-by: Anton Dekusar <[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.
Thanks, looks good
* optimize fqk parameterization * Update qiskit_machine_learning/kernels/fidelity_quantum_kernel.py Co-authored-by: Anton Dekusar <[email protected]> * Update qiskit_machine_learning/kernels/fidelity_quantum_kernel.py * remove vstack --------- Co-authored-by: Anton Dekusar <[email protected]>
Summary
This PR optimizes the way
indices
,right_parameters
andleft_parameters
are created in_get_symmetric_parameterization
and_get_parameterization
of theFidelityQuantumKernel
class.Details and comments
The previous version used a heavy amount of dynamic memory allocation which resulted in a very long runtime. This new version runs way faster for bigger instances by not using dynamic memory allocation. I didn't add any additional tests, since this doesn't introduce any new functionality.
I'm happy to incorporate comments and hope this can be merged soon 😄