qrisp.quantum_network.QuantumNetworkClient.send_qubits#

QuantumNetworkClient.send_qubits(recipient, qubits, annotation)[source]#

Sends the specified qubits to another participant of the network.

Parameters
recipientstr

The recipients name.

qubitslist[Qubit]

The list of qubits to send.

annotationstr

A string containing an arbitrary message that is available for the reciepient.

Examples

We create a QuantumNetworkServer, connect two clients and distribute a bell pair another client.

>>> from qrisp.quantum_network import QuantumNetworkServer, QuantumNetworkClient
>>> local_server = QuantumNetworkServer("127.0.0.1", background = True)
>>> local_server.start()
>>> alice_client = QuantumNetworkClient(name = "alice", socket_ip = "127.0.0.1")
>>> bob_client = QuantumNetworkClient(name = "bob", socket_ip = "127.0.0.1")

Now we create the bell pair:

>>> from qrisp import QuantumCircuit
>>> qc = QuantumCircuit(2)
>>> qc.h(0)
>>> qc.cx(0,1)
>>> alice_client.run(qc)
{'': 1}

Send one of the qubits to Bob:

>>> alice_client.send_qubits("bob", [qc.qubits[0]], annotation = "Happy birthday!")

Now Bob can measure

>>> messages = bob_client.inbox()
>>> received_qubits, annotation = messages[0]
>>> qc = bob_client.get_clear_qc()
>>> qc.measure(received_qubits)
>>> bob_client.run(qc)
{'1': 1}

After Bob’s measurement, we expect Alice’s measurement to yield the same due to spukhafter Fernwirkung:

>>> qc = alice_client.get_clear_qc()
>>> qc.measure(qc.qubits)
>>> alice_client.run(qc)
{'1': 1}