I'm running a quantum simulation and want to obtain some information from a single shot of an experiment. Here's part of the code I'm working on:
for i in range(Nshot):
Expeb = []
for measure_circuit in [circ_1, circ_2, circ_3, circ_4]:
measure_circuit = transpile(measure_circuit,backend=backend,optimization_level=2,initial_layout = [1])
counts = execute(measure_circuit, backend = backend, shots=1).result().get_counts()
for output in ['0','1']:
if output not in counts:
counts[output] = 0
expe = (counts['0'] - counts['1'])
Expeb.append(expe)
Est = sum(x*y for x,y in zip(Expeb,[a,b,c,d]))
The code works on simulators, but it might take a very long time if Nshot
gets large (Like 5000, I think that's because I generated a lot of circuits) and I submit the jobs to a quantum device. I wonder is there a way I can extract information (like making calculations for) a single shot but in a more efficient way? Thanks for the help!
shots = 1
, butNshot
could be large) $\endgroup$