# How do I get sate vector for each shot running on a quantum computer?

I was running this code on a quantum computer how can I generate a state vector for each shot while running on a quantum computer?

qikit code

## initiate alpha beta with own values
vector = [alpha,beta]
print('non normalised vector form a multi vector is')
print(vector)
norm = np.linalg.norm(vector)
print(norm)

qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit
initial_state = vector/np.linalg.norm(vector)
print('initial state is')
print(initial_state)
qc.initialize(initial_state, 0)
qc.x(0) ###### for not gate
a = qc.draw()
print(a)

simulator = Aer.get_backend('statevector_simulator')
qobj = assemble(qc)     # Create a Qobj from the circuit for the simulator to run
result = simulator.run(qobj).result() # Do the simulation and return the result
out_state = result.get_statevector()
print(out_state)

from qiskit import IBMQ

#provider = IBMQ.get_provider = ('ibm-q')
qcomp= provider.get_backend('ibmq_qasm_simulator')
job = execute(qc,backend=qcomp)
from qiskit.tools.monitor import  job_monitor
job_monitor(job)
result = job.result()
plot_histogram(result.get_counts(qc))


You can use the qiskit Snapshot extension. Here is an example:

from qiskit.providers.aer.extensions.snapshot import Snapshot
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit import QuantumCircuit, execute, Aer

circuit = QuantumCircuit(1, 1)
circuit.h(0)
circuit.measure([0], [0])
circuit.snapshot('final', snapshot_type='statevector')

print(circuit)
backend = Aer.get_backend('qasm_simulator')
job = execute(circuit, backend, shots = 10)
result = job.result()
pprint(result.data(0)['snapshots'])

┌───┐┌─┐┌───────┐
q_0: ┤ H ├┤M├┤ final ├
└───┘└╥┘└───────┘
c: 1/══════╩══════════
0
{'statevector': {'final': [array([1.+0.j, 0.+0.j]),
array([1.+0.j, 0.+0.j]),
array([0.+0.j, 1.+0.j]),
array([0.+0.j, 1.+0.j]),
array([0.+0.j, 1.+0.j]),
array([1.+0.j, 0.+0.j]),
array([1.+0.j, 0.+0.j]),
array([0.+0.j, 1.+0.j]),
array([1.+0.j, 0.+0.j]),
array([0.+0.j, 1.+0.j])]}}


• Thank you for responding, Is it possible to run the snapshot on the real quantum computer? Mar 2, 2021 at 5:09
• No. I don't think so. Mar 2, 2021 at 17:49