from qiskit.providers import aer from qiskit.circuit import QuantumCircuit,reset def run_circuit(circuit:QuantumCircuit) print(circuit) simulator = aer.Aer.get_backend("statevector_simulator") result1 = simulator.run(circuit).result() statevector1 = result1.get_statevector(circuit) prob_vector1 = Statevector(statevector1).probabilities() print(prob_vector1) result2=simulator.run(circuit).result() statevector2 = result2.get_statevector(circuit) prob_vector2 = Statevector(statevector2).probabilities() print(prob_vector2)
As you can see from the print line after the circuit, the probability vector is mixed up for the same circuit when run twice. Does anyone know why this is happening? I am assuming it has something to do with the reset operation, as without it it works fine everytime. But is there a way to do the reset operation and not get this bug?
Thanks and Best Regards
Edit with New Information:
So it seems that when you use the reset operation, rather than give you the new state vector, it causes the collapse of the state vector and gives full probability to a specific state. I have these images from the IBMQ lab that show what I am taking about. Does anyone know how to make it so that it gives the correct state vector and not the collapsed state?