You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: Ubuntu 20 and Windows 10 (tested multiple)
What is the current behavior?
If I use set_matrix_product_state to set an initial state in the simulator - it's not loaded properly.
The state is generated manually, and follows the correct structure used in qiskit (see also https://arxiv.org/abs/quant-ph/0301063),
however fails to be uploaded to the simulator.
Steps to reproduce the problem
In this example we prepare a Bell state, though the issue is not related to a particular state or system size.
import qiskit
import qiskit_aer
import numpy as np # ==1.26.4 in our experiment
# bell state
statevector = np.array([1.0 + 0.j, 0.0 + 0.j, 0.0 + 0.j, 1.0 + 0.j]) / np.sqrt(2)
# also try state [1, 0, 0, 1.j] or others, it's not related to bell states
simulator = qiskit_aer.AerSimulator(method="matrix_product_state")
Since this is a 2 qubit state, it can be very quickly decomposed to MPS via a single SVD:
The state mps_state is a correct MPS state expected by the simulator. In the first test we expect to get a statevector for a Bell state, in the 2nd test we expect to return the same state as loaded.
We also manually tested MPS conversation via qiskit like: set statevector, save matrix product state right after. We compare the obtained state to mps_state and see that distance between all matrices is 0. Yet if we load back the state returned by qiskit - it will load properly, while the state prepared by SVD will not.
For our purposes, however, we can not use such method of creating the MPS state via loading a full statevector to qiskit, for example, because of memory issues at large scale. Yet we see no mathematical and numerical difference between these two MPS states.
Suggested solutions
Since we have no access to a compiled code of Aer, we can not know what is happening. Though we can point out that the issue occurs only when we work with complex valued states, e.g. in our example for the Bell state we could use type float everywhere, then the procedure won't produce any error -- this is why we also proposed to check state with a complex amplitude in the comment.
The text was updated successfully, but these errors were encountered:
Informations
What is the current behavior?
If I use
set_matrix_product_state
to set an initial state in the simulator - it's not loaded properly.The state is generated manually, and follows the correct structure used in qiskit (see also https://arxiv.org/abs/quant-ph/0301063),
however fails to be uploaded to the simulator.
Steps to reproduce the problem
In this example we prepare a Bell state, though the issue is not related to a particular state or system size.
Since this is a 2 qubit state, it can be very quickly decomposed to MPS via a single SVD:
One can easily verify that it's a correct MPS state, in a correct canonical form, and even matches all types and structures as qiskit uses.
Now let us simply load it and get a statevector back
Note that qiskit returns the incorrect statevector, it's not even properly normalized.
If we get back the MPS state instantly like this
Note the missing 1 in the last matrix in gammas.
What is the expected behavior?
The state
mps_state
is a correct MPS state expected by the simulator. In the first test we expect to get a statevector for a Bell state, in the 2nd test we expect to return the same state as loaded.We also manually tested MPS conversation via qiskit like: set statevector, save matrix product state right after. We compare the obtained state to
mps_state
and see that distance between all matrices is 0. Yet if we load back the state returned by qiskit - it will load properly, while the state prepared by SVD will not.For our purposes, however, we can not use such method of creating the MPS state via loading a full statevector to qiskit, for example, because of memory issues at large scale. Yet we see no mathematical and numerical difference between these two MPS states.
Suggested solutions
Since we have no access to a compiled code of Aer, we can not know what is happening. Though we can point out that the issue occurs only when we work with complex valued states, e.g. in our example for the Bell state we could use type
float
everywhere, then the procedure won't produce any error -- this is why we also proposed to check state with a complex amplitude in the comment.The text was updated successfully, but these errors were encountered: