# Quantum teleportation using Blueqat SDK

May 19 · 3 min read

# Introduction

I would like to implement quantum teleportation using Blueqat SDK on universal gate machine.

# What is Blueqat?

Blueqat is an open source library for quantum computer.

Blueqat is provided as Python (ver 3.6+) library. You can install by pip.

`pip install blueqat`

# Quantum teleportation

Although it is named teleportation, it does not mean particles move instantaneously to different places in space. When observing the state of one of the two particles of quantum entanglement, the other state is confirmed instantaneously.

Quantum teleportation occurs between two particles in the quantum entanglement relationship of EPR pairs.

As introduced above, quantum states can be photographed by generating quantum entanglement, measuring it, manipulating it, and manipulating the final qubits of the transfer destination with the measurement result.

# Looking at the circuit

First prepare the state of q0. Next, q1 and q2 make quantum entanglement. You can achieve quantum entanglement state called EPR pair by applying H gate to q1 and CNOT on q1 and q2. And it is called bell measurement, make measurements by generating tangle at q0, q1 and applying H gate to q 0. In this case, we will substitute CX / CZ circuit instead of measurement. Originally we will do the measurement instead of CX / CZ and apply X gate, Z gate.

``````q0 -?-----*-H-----*-------
q1 ---H-*-X---*---|-------
q2 -----X-----X-H-X-H-----``````

Blueqat code is,

``````from blueqat import Circuit
import math

#quantum teleportation circuit
Circuit().h[1].cx[1,2].cx[0,1].h[0].cx[1,2].h[2].cx[0,2].h[2]``````

Let’s prepare |0> and try the circuit

``````for i in range(20):
c = Circuit().h[1].cx[1,2].cx[0,1].h[0].cx[1,2].h[2].cx[0,2].h[2].m[:]
c.run()
print(c.last_result())

(0, 0, 0)
(0, 1, 0)
(0, 1, 0)
(1, 1, 0)
(0, 1, 0)
(0, 0, 0)
(0, 0, 0)
(0, 1, 0)
(0, 0, 0)
(1, 1, 0)
(0, 1, 0)
(0, 1, 0)
(1, 0, 0)
(1, 1, 0)
(1, 0, 0)
(1, 0, 0)
(0, 1, 0)
(1, 1, 0)
(1, 0, 0)
(1, 1, 0)``````

We succeded to transfer the state of first qubit to the third qubit.

And next we try |1>

``````for i in range(20):
c = Circuit().x[0].h[1].cx[1,2].cx[0,1].h[0].cx[1,2].h[2].cx[0,2].h[2].m[:]
c.run()
print(c.last_result())

(1, 1, 1)
(0, 0, 1)
(0, 1, 1)
(1, 0, 1)
(1, 0, 1)
(1, 1, 1)
(1, 1, 1)
(0, 1, 1)
(1, 0, 1)
(0, 1, 1)
(1, 1, 1)
(1, 0, 1)
(1, 1, 1)
(1, 1, 1)
(1, 0, 1)
(0, 1, 1)
(0, 1, 1)
(1, 1, 1)
(0, 1, 1)
(1, 0, 1)``````

And finally try on superposition of 0 and 1.

``````for i in range(20):
c = Circuit().h[0].h[1].cx[1,2].cx[0,1].h[0].cx[1,2].h[2].cx[0,2].h[2].m[:]
c.run()
print(c.last_result())

(1, 1, 0)
(0, 1, 0)
(0, 0, 1)
(0, 1, 1)
(1, 1, 1)
(0, 1, 1)
(1, 1, 0)
(1, 1, 0)
(1, 0, 0)
(0, 0, 0)
(1, 0, 1)
(0, 1, 0)
(1, 0, 1)
(1, 0, 0)
(0, 0, 1)
(1, 1, 0)
(0, 1, 0)
(1, 1, 0)
(0, 0, 1)
(0, 0, 1)``````

The overlayed state has shifted so that 0 and 1 come to q2 in about half probability.

If you have any questions or suggestions, please feel free to contact us by our Slack community. (Join from here)

Written by