In Qiskit I can construct a computational basis statevector in the following fashion
from qiskit.quantum_info import Statevector
sv = Statevector.from_label('10')
print(sv.data)
which gives [0.+0.j 0.+0.j 1.+0.j 0.+0.j]
. If I have the data for a statevector in the computation basis, is there a built-in way to return a corresponding string? For [0.+0.j 0.+0.j 1.+0.j 0.+0.j]
I should get back '10'
. More generally, if the state is not in the computational basis it would be nice to get a linear combination of the basis states.
[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]
, not what you put on your question. Are you sure about your array? From the looks of it it would be a statevector describing a 2-qubits state, not 4. $\endgroup$