I have a simple circuit which I run for 10 shots:
from qiskit.quantum_info import Statevector from qiskit import Aer, execute, QuantumCircuit from qiskit.quantum_info import Statevector backend = Aer.get_backend("statevector_simulator") qc2 = QuantumCircuit(2, 1) qc2.h(0) qc2.measure(, ) print(qc2) result = execute(qc2, backend=backend, shots=10).result()
Now, when I print the state vector with:
print('State after measurement:', result.get_statevector())
The output is:
State after measurement: Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], dims=(2, 2))
The question is that to which of the 10 shots does this state vector belong to? Depending on the measurement, the state vector should be different - when q0 is measured as 0 and when q0 is 1.
And how do I get the statevector for each shot?