I am trying to simulate quantum teleportation on ProjectQ using simulaqron (enabling me to use quantum internet for teleportation) however I am not sure if my approach is right. In the working paper of simulaqron its written that programming via another backend like ProjectQ is very much possible. However when I am testing quantum teleporation I am not getting any output
[Alice's code] followed by [Bob's code]
from projectq.ops import All, CNOT, H, Measure, Rz, X, Z
from projectq import MainEngine
from projectq.meta import Dagger, Control
from cqc.pythonLib import CQCConnection, qubit
import simulaqron
def main():
with CQCConnection("Alice") as Alice:
eng = MainEngine()
c1, c2 = create_bell_pair(eng)
tel1 = eng.allocate_qubit()
Alice.sendQubit((c1, "Bob"))
H | tel1
CNOT | (tel1, c2)
H | tel1
Measure | tel1
Measure | c2
to_print = "App {}: Measurement outcomes are: a={}, b={}".format(Alice.name, int(tel1), int(c2))
print("|" + "-" * (len(to_print) + 2) + "|")
print("| " + to_print + " |")
print("|" + "-" * (len(to_print) + 2) + "|")
# Send corrections to Bob
Alice.sendClassical("Bob", int(tel1), int(c2))
def create_bell_pair(eng):
b1 = eng.allocate_qubit()
b2 = eng.allocate_qubit()
H | b1
CNOT | (b1, b2)
return b1, b2
main()
// new file for bob
from projectq.ops import All, CNOT, H, Measure, Rz, X, Z
from projectq import MainEngine
from projectq.meta import Dagger, Control
from cqc.pythonLib import CQCConnection, qubit
import simulaqron
#####################################################################################################
#
# main
#
def main():
# Initialize the connection
with CQCConnection("Bob") as Bob:
# Make an EPR pair with Alice
qB=Bob.recvQubit(c1, "Alice")
# Receive info about corrections
data=Bob.recvClassical()
message=list(data)
a=message[0]
b=message[1]
# Apply corrections
if b==1:
X | qB
if a==1:
Z | qB
# Measure qubit
Measure | qB
to_print="App {}: Measurement outcome is: {}".format(Bob.name,int(qB))
print("|"+"-"*(len(to_print)+2)+"|")
print("| "+to_print+" |")
print("|"+"-"*(len(to_print)+2)+"|")
##################################################################################################
main()