Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Quantum Teleportation with c_if Gates #7

Open
MattePalte opened this issue Jan 30, 2024 · 0 comments
Open

Improving Quantum Teleportation with c_if Gates #7

MattePalte opened this issue Jan 30, 2024 · 0 comments

Comments

@MattePalte
Copy link

Environment

  • qiskit.version: 0.25.1
  • Python version: 3.8.0
  • Operating system: Ubuntu 20.04

What is happening?

In the Python file one_qubit.py, the cx and cz gates are used instead of the controlled c_if gates. Although the code most probably return a similar distribution, the code disagrees with the Qiskit official version that more closely follows the quantum teleportation specification.

How can we reproduce the issue?

Run the following code in the Python file:

from qiskit import *

# Define register of 3 qubits
q = QuantumRegister(3)
c = ClassicalRegister(2)
circuit = QuantumCircuit(q,c)

# Generate entanglement
circuit.h(1)
circuit.cx(1, 2)
circuit.barrier()

# Perform Bell state measurement
circuit.cx(0, 1)
circuit.h(0)
circuit.measure(0, 0)
circuit.measure(1, 1)

# Operate on Bob's qubit given result
circuit.cx(0, 2)
circuit.cz(1, 2)

print(circuit)

The cx and cz gates are not conditioned on the classical register.

Any Suggestions?

The code should probably use the c_if gates instead of the cx and cz gates. An example could be:

q = QuantumRegister(3)
c1 = ClassicalRegister(1)
c2 = ClassicalRegister(1)
circuit = QuantumCircuit(q,c1,c2)
circuit.h(1)
circuit.cx(1, 2)
circuit.barrier()
circuit.cx(0, 1)
circuit.h(0)
circuit.measure(0, 0)
circuit.measure(1, 1)
circuit.x(2).c_if(c1, 1)
circuit.z(2).c_if(c2, 1)
print(circuit)

Thanks in advance, I wish you a happy and productive day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant