Quantum Computing Asked by HYW on September 26, 2021
I implemented 2 versions of the entanglement swapping circuit in IBM Q. One is using classical measurement to control X, Z gates. Another is just us C-NOT and Controlled-Z. They should be equivalent. The 1st and 2nd bits were entangled. After teleportation of the 2nd bit to the 4th bit, I expect the 1st and the 4th bit will be entangled. I can see that when using the 2nd method. But not the case for 1st method. Did I make a mistake or there is a bug?
Method 1:
Method 2:
There is a mistake in design of the first circuit. Both $X$ and $Z$ gate work when value 1 is in classical register.
Gate $X$ should work in case qubit $q_2$ is in state $|1rangle$. Similarly $Z$ acts when $q_1$ in state $|1rangle$. Also you have to deal with state when both $X$ and $Z$ have to act. In your case you conditioned both $X$ and $Z$ on c==1
. It means that both gates act in case $q_1$ is in state $|1rangle$. Another mistake come from measuring qubits $q_1$ and $q_2$ in the first circuit while not to measure them in the second one (in this case they are alway zero).
Please see here QASM commented code producing results you desired:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[5];
//teleport
h q[0];
h q[2];
cx q[0],q[1];
cx q[2],q[3];
cx q[1],q[2];
h q[1];
//measuring q1 and q2
//for controlled gates
measure q[2] -> c[0];
measure q[1] -> c[1];
//set q1 and q2 to |0> to
//emulate they are not measured
reset q[1];
reset q[2];
//controlled gates
//q1 = |0>, q2 =|1>
if (c==1) x q[3];
//q1 = |1>, q2 =|0>
if (c==2) z q[3];
//q1 = |1>, q2 =|1>
if (c==3) x q[3];
if (c==3) z q[3];
//measure qubits
measure q[3] -> c[3];
measure q[0] -> c[0];
measure q[1] -> c[1];
measure q[2] -> c[2];
Correct answer by Martin Vesely on September 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP