-
Notifications
You must be signed in to change notification settings - Fork 354
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
Calling AerState amplitude (also probability) is slow #2073
Comments
I think |
As @doichanj mentioned, qiskit-aer/qiskit_aer/quantum_info/states/aer_statevector.py Lines 143 to 156 in 74e4397
Again, |
I'm already using move_to_vector as a workaround. AerState is actually exposed in contrib/runtime (indeed, casted to a void*) and both |
Informations
What is the current behavior?
The problem appears for the default 'statevector' simulation.
I used the qiskit aer simulator to up to 27 qubits lately, also my own simulator (qcsim: https://github.com/aromanro/QCSim) in a c++ project. To ensure that the results are ok, I have some tests that at the end of the simulations they check the outcome by comparing the amplitudes from both simulators.
I noticed that getting the amplitudes like that is really slow for qiskit aer (compared with qcsim).
I know that flush_ops() needs to be called to have the ops actually applied, I ensured that it is actually called at the end of the simulation, so that's not the reason of the slow behavior for the
amplitude
call.Steps to reproduce the problem
Just use a > 20 qubits simulator and try getting the amplitudes for all states.
What is the expected behavior?
I expected it to be much faster... not as fast as qcsim, as there is more involved (qcsim is very simple and it simply does this: https://github.com/aromanro/QCSim/blob/75e009f76828ee444566502242f56d359b310573/QCSim/QubitRegister.h#L33) but aer is much slower. Unfortunately this might prevent me to use it for some things in that project.
Suggested solutions
One workaround I found for what I do (unfortunately I cannot give details because I signed an NDA, I must ask for approval) is to use
move_to_vector
, but unfortunately this is destructive for the internal state... maybe theamplitude
andprobability
calls could be improved somehow to be faster?The text was updated successfully, but these errors were encountered: