Created
September 6, 2018 09:04
-
-
Save quantumjim/ec483daa64733412531ebf10b3b42ba3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, execute | |
shots = 1024 | |
n = 10 | |
batch = [] | |
for run in range(n): | |
qr = QuantumRegister(1) | |
cr = ClassicalRegister(1) | |
qc = QuantumCircuit(qr, cr) | |
qc.h(qr[0]) | |
qc.measure(qr,cr) | |
batch.append(qc) | |
job = execute(batch, backend='local_qasm_simulator', shots=shots) | |
for circuit in batch: | |
print( job.result().get_counts(circuit)['1']/shots ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment