SoftwareQuTech / SimulaQron

Quantum Network Simulator for Application Programming
Other
113 stars 53 forks source link

Unable to create remote entanglement #266

Closed ganeshmylavarapu-qp closed 3 years ago

ganeshmylavarapu-qp commented 4 years ago

Hello,

I am trying to implement a paper on quantum internet. The paper states that if A, B, C are three nodes. B has two qubits out of which one qubit is entangled with A, other qubit is entangled with C. Now, if I create entanglement between two qubits in B, then automatically A and C are also entangled. I can send classical information from A to C directly without sending via B.

When I implemented the code in simulaqron, I am unable to create a connection between A and C and unable to send classical information directly from A to C.

Your help would greatly benefit me.

I am attaching the code for reference.

###############################CODE ######################################

from cqc.pythonLib import CQCConnection, qubit

import sys
from timeit import default_timer as timer

#####################################################################################################
#
# main
#
def main():

    with CQCConnection("Alice") as Alice:

        # Make an EPR pair with Bob
        qA = Alice.createEPR("Bob")

        # Create a qubit to teleport
        q = qubit(Alice)

        # Prepare the qubit to teleport in |+>
        q.H()

        # Apply the local teleportation operations
        q.cnot(qA)
        q.H()

        # Measure the qubits
        a = q.measure()
        b = qA.measure()
        to_print = "App {}: Measurement outcomes are: a={}, b={}".format(Alice.name, a, b)
        print("|" + "-" * (len(to_print) + 2) + "|")
        print("| " + to_print + " |")
        print("|" + "-" * (len(to_print) + 2) + "|")    

    with CQCConnection("Bob") as Bob:

        # Make an EPR pair with Alice
        qB = Bob.recvEPR()

        # Make an EPR pair with Charlie
        qEPR = Bob.createEPR("Charlie")
        #qEPR = qubit(Bob)

        # Entangle both qubits
        qB.cnot(qEPR)

        # Send qubit to Charlie
        #Bob.sendQubit(qEPR, "Charlie")

    with CQCConnection("Charlie") as Charlie:

        qC = Charlie.recvEPR()
        #qC = Charlie.recvQubit()
        #qC1 = qubit(Charlie)
        #qC.cnot(qC1)
        # Receive info about corrections
        data = Charlie.recvClassical()
        print(data)
        message = list(data)
        a = message[0]
        b = message[1]

        # Apply corrections
        if b == 1:
            qC1.X()
        if a == 1:
            qC1.Z()

            # Measure qubit
        m = qC.measure()
        to_print = "App {}: Measurement outcome is: {}".format(Charlie.name, m)
        print("|" + "-" * (len(to_print) + 2) + "|")
        print("| " + to_print + " |")
        print("|" + "-" * (len(to_print) + 2) + "|")

##################################################################################################
main()
ganeshmylavarapu-qp commented 4 years ago

In the earlier code Alice.sendClassical("Charlie", [a, b]) is missing. I included that as well in the code. Please find the updated code. node.py.zip

ganeshmylavarapu-qp commented 4 years ago

Attached the paper for reference. Remote Preparation and Distribution of Bipartite Entangled States.zip

AckslD commented 3 years ago

Hi @ganeshmylavarapu-qp! You cannot put all the nodes scripts in the same file since they will then block each other and cause a deadlock. The docs explains how to write an application and execute it. Also refer to the examples for more tips.

ganeshmylavarapu-qp commented 3 years ago

Hi Axel Dahlberg ,

Thanks for your response. I split the script into three different scripts and now it is working as expected. I will manually increase the number of scripts for each node and continue my work.

Regards, Ganesh Mylavarapu

From: Axel Dahlberg notifications@github.com Reply-To: SoftwareQuTech/SimulaQron reply@reply.github.com Date: Monday, November 16, 2020 at 9:08 PM To: SoftwareQuTech/SimulaQron SimulaQron@noreply.github.com Cc: mylavarapu Ganesh ganesh.mylavarapu@research.iiit.ac.in, Mention mention@noreply.github.com Subject: Re: [SoftwareQuTech/SimulaQron] Unable to create remote entanglement (#266)

Hi @ganeshmylavarapu-qphttps://github.com/ganeshmylavarapu-qp! You cannot put all the nodes scripts in the same file since they will then block each other and cause a deadlock. The docshttps://softwarequtech.github.io/SimulaQron/html/GettingStarted.html explains how to write an application and execute it. Also refer to the exampleshttps://github.com/SoftwareQuTech/CQC-Python/tree/master/examples/pythonLib for more tips.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/SoftwareQuTech/SimulaQron/issues/266#issuecomment-728140054, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQDILICZY6TMPKPHUTQHETDSQFBONANCNFSM4TURNXSA.

AckslD commented 3 years ago

Great to hear @ganeshmylavarapu-qp