1
$\begingroup$
qr = QuantumRegister(2)
cr = ClassicalRegister(2)

# Creating a Bell circuit
qc_if_else = QuantumCircuit(qr, cr)

qc_if_else.h(0)
qc_if_else.measure(0, 1)

with qc_if_else.if_test((cr[0], True)) as else_:
    qc_if_else.x(0)
with else_:
    qc_if_else.x(1)

qc_if_else.measure(0, 1)

qc_if_else.draw(output="mpl", idle_wires=False)

I am following this Tutorial on dynamic circuits, what I understood from the above piece of code is that we measure the qubit zero and store the value in the register with index 1 (that is the second register) , and then we test if cr[0] is True which will be False as its zero because we didnt measure anything and store it in cr[0] so it will go to the else block which applies X gate on the qubit with index 1 (the second qubit). and then measure the qubit zero and again store it in the classical register with index[1] (the second register).

Is my understanding of the above circuit correct? I dont understand how the above circuit creates a bell circuit? It would be very helpful if someone can break the circuit and explain.

$\endgroup$

1 Answer 1

1
$\begingroup$

Hadamard gate creates equal superposition on qubit 0. Qubit 1 remains in state $|0\rangle$. Then qubit 0 is measured. If the result is $|1\rangle$, then this qubit is inverted and it is finally in state $|0\rangle$. State of both qubits is therefore $|00\rangle$. If result of measurement is $|0\rangle$, then qubit 1 is inverted, hence it is in state $|1\rangle$. State of both qubits is therefore $|01\rangle$. This is consistent with the tutorial (up to order of qubits). Since probability of qubit 0 being in either state $|0\rangle$ or $|1\rangle$ is 50%, effectively two qubit state is $|00\rangle + |01\rangle$ (up to normalization constant).

However, this state has nothing to do with Bell state because the state is not entangled. It is clearly separable: $|0\rangle \otimes (|0\rangle + |1\rangle)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.