Skip to content

Instantly share code, notes, and snippets.

@datafatmunger
Created July 9, 2020 12:21
Show Gist options
  • Save datafatmunger/a9e0da8ef9cf5a3667a065c9a4381016 to your computer and use it in GitHub Desktop.
Save datafatmunger/a9e0da8ef9cf5a3667a065c9a4381016 to your computer and use it in GitHub Desktop.
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, Aer
crz, crx, result = ClassicalRegister(1), ClassicalRegister(1), ClassicalRegister(1)
q = QuantumRegister(3)
qc = QuantumCircuit(q, crz, crx, result)
qc.x(0)
## Bell pair - JBG
qc.h(1)
qc.cx(1, 2)
qc.barrier(q)
qc.cx(0, 1)
qc.measure(1, 1)
qc.x(2).c_if(crx, 1)
qc.h(0)
qc.measure(0, 0)
qc.z(2).c_if(crz, 1)
qc.measure(2, 2)
counts = execute(qc, Aer.get_backend('qasm_simulator')).result().get_counts()
print(counts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment