From 5535bb0655461f3689677c64195d40fe3200653c Mon Sep 17 00:00:00 2001 From: lealexis Date: Sat, 20 Aug 2022 18:43:41 +0200 Subject: [PATCH 1/5] get density operator mathematical error debugged. --- qunetsim/backends/eqsn_backend.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qunetsim/backends/eqsn_backend.py b/qunetsim/backends/eqsn_backend.py index 0266fb0..77c82eb 100644 --- a/qunetsim/backends/eqsn_backend.py +++ b/qunetsim/backends/eqsn_backend.py @@ -152,9 +152,15 @@ def create_qubit(self, host_id): host_id (str): Id of the host to whom the qubit belongs. Returns: + # TODO: Bug, functions is returning a string object but not the + generated Qubit. Qubit of backend type. """ - id = str(uuid.uuid4()) + #id = str(uuid.uuid4()) + #self.eqsn.new_qubit(id) + ##return id + + id = uuid.uuid4() self.eqsn.new_qubit(id) return id @@ -412,7 +418,8 @@ def density_operator(self, qubit): """ qubits, statevector = self.eqsn.give_statevector_for(qubit.qubit) index = qubits.index(qubit.qubit) - density_operator = np.outer(statevector, statevector) + # density_operator = np.outer(statevector, statevector) + density_operator = np.outer(statevector, np.conjugate(statevector)) before = 2**index if before > 0: other = 2**(len(qubits) - index) From b8a1f5dae321361a675299f86f77911feb0b1e22 Mon Sep 17 00:00:00 2001 From: lealexis Date: Sat, 20 Aug 2022 18:45:22 +0200 Subject: [PATCH 2/5] density operator actualized, statevector method added. --- qunetsim/objects/qubit.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/qunetsim/objects/qubit.py b/qunetsim/objects/qubit.py index 2b0b818..0adc632 100644 --- a/qunetsim/objects/qubit.py +++ b/qunetsim/objects/qubit.py @@ -120,7 +120,8 @@ def fidelity(self, other_qubit): Determines the quantum fidelity between this and the given qubit. Args: - other_qubit (Qubit): The other (apart from this) qubit used to calculate the quantum fidelity + other_qubit (Qubit): The other (apart from this) qubit used to + calculate the quantum fidelity Returns: (float) The quantum fidelity between this and the given qubit. @@ -314,7 +315,12 @@ def density_operator(self): Returns: np.ndarray: The density operator of the qubit. """ - return self._host.backend.density_operator(self) + if np.shape(self.statevector()[1])[0] == 2: + return self._host.backend.density_operator(self) + else: + ket = np.reshape(self.statevector()[1],(np.shape(self.statevector()[1])[0], 1)) + bra = np.conjugate(ket.T) + return ket * bra def measure(self, non_destructive=False): """ @@ -329,6 +335,9 @@ def measure(self, non_destructive=False): """ return self._host.backend.measure(self, non_destructive) + def statevector(self): + return self._host.backend.statevector(self) + def is_unitary(m): return np.allclose(np.eye(m.shape[0]), m.conj().T.dot(m)) From 05ffa957982a470f9ff23e01237d2fe2c9403b0b Mon Sep 17 00:00:00 2001 From: lealexis Date: Sat, 20 Aug 2022 18:46:24 +0200 Subject: [PATCH 3/5] method for dropping qubit added. --- qunetsim/objects/storage/quantum_storage.py | 34 ++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/qunetsim/objects/storage/quantum_storage.py b/qunetsim/objects/storage/quantum_storage.py index 0c68a10..0411b88 100644 --- a/qunetsim/objects/storage/quantum_storage.py +++ b/qunetsim/objects/storage/quantum_storage.py @@ -101,6 +101,7 @@ def set_storage_limit_with_host(self, new_limit, host_id): """ Set a new storage limit for the storage. The implementations depends on the storage mode. + TODO: It seems as the implementations for the other modes were ignored! Args: new_limit (int): The new max amount of qubit. @@ -283,6 +284,23 @@ def reset_qubits_from_host(self, from_host_id, purpose=None): self._get_qubit_from_host(from_host_id, purpose=purpose) self.lock.release_write() + # TODO: this function needs to be pushed onto github + def reset_qubit_from_host(self, from_host_id, q_id, purpose=None): + """ + Remove qubit *q_id* from the host *from_host_id*. + + Args: + from_host_id (str): The host who the qubits are from + purpose (int): + """ + self.lock.acquire_write() + if from_host_id in self._host_dict: + if q_id in self._qubit_dict and\ + from_host_id in self._qubit_dict[q_id]: + if purpose is None or (purpose == self._purpose_dict[q_id][from_host_id]): + self._get_qubit_from_host(from_host_id, q_id, purpose) + self.lock.release_write() + def _check_all_requests(self): """ Checks if any of the pending requests is now fulfilled. @@ -324,21 +342,23 @@ def _remove_request(self, req_id): def get_qubit_from_host(self, from_host_id, q_id=None, purpose=None, wait=0): """ - Returns next qubit which has been received from a host. If the qubit has - not been receives yet, the thread is blocked for a maxiumum of the wait time, - till the qubit arrives (The default is 0). If the id is given, the exact qubit with the id - is returned, or None if it does not exist. + Returns next qubit which has been received from a host. If the qubit + has not been received yet, the thread is blocked for a maxiumum of the + wait time, till the qubit arrives (The default is 0). If the id is + given, the exact qubit with the id is returned, or None if it does not + exist. The qubit is removed from the quantum storage. Args: from_host_id (str): Host id from who the qubit has been received. q_id (str): Optional Id, to return the exact qubit with the Id. purpose (str): Optional, purpose of the Qubit. - wait (int): Default is 0. The maximum blocking time. -1 if blocking forever. + wait (int): Default is 0. The maximum blocking time. -1 if blocking + forever. Returns: - (bool): If such a qubit exists, it returns the qubit. Otherwise, None - is returned. + (bool): If such a qubit exists, it returns the qubit. Otherwise, + None is returned. """ # Block forever if wait is -1 if wait == -1: From e0f258574eb02de23e32d534a0345cb4f82fc7ef Mon Sep 17 00:00:00 2001 From: lealexis Date: Sat, 20 Aug 2022 18:47:23 +0200 Subject: [PATCH 4/5] method added to drop a qubit. --- qunetsim/components/host.py | 49 +++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/qunetsim/components/host.py b/qunetsim/components/host.py index 3c0ac55..025e66b 100644 --- a/qunetsim/components/host.py +++ b/qunetsim/components/host.py @@ -1214,17 +1214,20 @@ def get_epr_pairs(self, host_id): def get_data_qubits(self, host_id, remove_from_storage=False): """ - Return the dictionary of data qubits stored, just for the information regarding which qubits are stored. - Optional to remove the qubits from storage like *get_data_qubit* does with *remove_from_storage* field. + Return the dictionary of data qubits stored, just for the information + regarding which qubits are stored. Optional to remove the qubits from + storage like *get_data_qubit* does with *remove_from_storage* field. Args: - host_id (str): The host id from which the data qubit have been received. + host_id (str): The host id from which the data qubit have been + received. remove_from_storage (bool): Get and remove from storage. Returns: - (dict): If *host_id* is not set, then return the entire dictionary of data qubits. - Else If *host_id* is set, then return the data qubits for that particular host if there are any. - Return an empty list otherwise. + (dict): If *host_id* is not set, then return the entire dictionary + of data qubits. Else If *host_id* is set, then return the + data qubits for that particular host if there are any. + Return an empty list otherwise. """ return self._qubit_storage.get_all_qubits_from_host(host_id, purpose=Qubit.DATA_QUBIT, @@ -1287,8 +1290,9 @@ def set_data_qubit_memory_limit(self, limit, host_id=None): def add_epr(self, host_id, qubit, q_id=None, blocked=False): """ - Adds the EPR to the EPR store of a host. If the EPR has an ID, adds the EPR with it, - otherwise generates an ID for the EPR and adds the qubit with that ID. + Adds the EPR to the EPR store of a host. If the EPR has an ID, adds the + EPR with it, otherwise generates an ID for the EPR and adds the qubit + with that ID. Args: host_id (str): The ID of the host to pair the qubit @@ -1420,8 +1424,9 @@ def get_next_classical(self, sender_id, wait=-1): def get_epr(self, host_id, q_id=None, wait=0): """ - Gets the EPR that is entangled with another host in the network. If qubit ID is specified, - EPR with that ID is returned, else, the last EPR added is returned. + Gets the EPR that is entangled with another host in the network. If + qubit ID is specified, EPR with that ID is returned, else, the last EPR + added is returned. Args: host_id (str): The ID of the host that returned EPR is entangled to. @@ -1435,13 +1440,20 @@ def get_epr(self, host_id, q_id=None, wait=0): return _get_qubit(self._qubit_storage, host_id, q_id, Qubit.EPR_QUBIT, wait) + # TODO: this function needs to be updated to qunetsim + def drop_epr(self, host_id, q_id=None): + _drop_qubit(self._qubit_storage, host_id, q_id, Qubit.EPR_QUBIT) + + def get_data_qubit(self, host_id, q_id=None, wait=0): """ - Gets the data qubit received from another host in the network. If qubit ID is specified, - qubit with that ID is returned, else, the last qubit received is returned. + Gets the data qubit received from another host in the network. If qubit + ID is specified, qubit with that ID is returned, else, the last qubit + received is returned. Args: - host_id (str): The ID of the host that data qubit to be returned is received from. + host_id (str): The ID of the host that data qubit to be returned is + received from. q_id (str): The qubit ID of the data qubit to get. wait (float): The amount of time to wait for the a qubit to arrive Returns: @@ -1571,15 +1583,20 @@ def delete_key(self, partner_id): def _get_qubit(store, host_id, q_id, purpose, wait=0): """ - Gets the data qubit received from another host in the network. If qubit ID is specified, - qubit with that ID is returned, else, the last qubit received is returned. + Gets the data qubit received from another host in the network. If qubit ID + is specified, qubit with that ID is returned, else, the last qubit received + is returned. Args: store: The qubit storage to retrieve the qubit - host_id (str): The ID of the host that data qubit to be returned is received from. + host_id (str): The ID of the host that data qubit to be returned is + received from. q_id (str): The qubit ID of the data qubit to get. purpose (str): The intended use of the qubit Returns: (Qubit): Qubit received from the host with *host_id* and *q_id*. """ return store.get_qubit_from_host(host_id, q_id, purpose, wait) + +def _drop_qubit(store, host_id, q_id, purpose): + store.reset_qubit_from_host(from_host_id=host_id, q_id=q_id, purpose=purpose) From d2208337fedd1cff37cfe86acfdb00da6f2421b9 Mon Sep 17 00:00:00 2001 From: lealexis Date: Tue, 21 Feb 2023 13:19:18 +0100 Subject: [PATCH 5/5] all conflicts manually resolved --- benchmarks/benchmark_protocols.py | 2 +- dev_requirements.txt | 16 +-- docs/_sources/components/host.rst.txt | 4 +- docs/_sources/examples/QKD_B92.rst.txt | 4 +- docs/_sources/examples/QKD_BB84.rst.txt | 6 +- .../examples/anonymous_transfer.rst.txt | 4 +- .../_sources/examples/packet_sniffing.rst.txt | 4 +- .../examples/quantum_coin_flipping.rst.txt | 12 +-- docs/_sources/examples/quantum_money.rst.txt | 8 +- docs/_sources/examples/send_data.rst.txt | 4 +- docs/_sources/quick_start.rst.txt | 2 +- docs/components/host.html | 14 +-- docs/examples/QKD_B92.html | 4 +- docs/examples/QKD_BB84.html | 8 +- docs/examples/anonymous_transfer.html | 4 +- docs/examples/packet_sniffing.html | 4 +- docs/examples/quantum_coin_flipping.html | 12 +-- docs/examples/quantum_money.html | 8 +- docs/examples/send_data.html | 4 +- docs/genindex.html | 4 +- docs/quick_start.html | 2 +- docs/searchindex.js | 2 +- docs/source/components/host.rst | 4 +- docs/source/examples/QKD_B92.rst | 4 +- docs/source/examples/QKD_BB84.rst | 8 +- docs/source/examples/anonymous_transfer.rst | 4 +- docs/source/examples/packet_sniffing.rst | 4 +- .../source/examples/quantum_coin_flipping.rst | 12 +-- docs/source/examples/quantum_money.rst | 8 +- docs/source/examples/send_data.rst | 4 +- docs/source/quick_start.rst | 2 +- examples/BB84/BB84_protocol.py | 2 +- examples/Q-TCP/q_tcp.py | 10 +- examples/Q-UDP/q_udp.py | 10 +- examples/QKD/BB84_without_interception.py | 2 +- examples/QKD/b92.py | 4 +- examples/QKD/b92_combined.py | 2 +- examples/QKD/bb84_combined.py | 2 +- examples/QKD/bbm92_combined.py | 2 +- examples/QKD/e91.py | 2 +- examples/QKD/e91_combined.py | 2 +- examples/QKD/qkd.py | 4 +- examples/QKD/qkd_b92.py | 2 +- examples/QKD/qkd_eqsn.py | 4 +- examples/QKD/qkd_projectq.py | 4 +- examples/QKD/qkd_qutip.py | 4 +- examples/QKD/six_state_protocol_combined.py | 2 +- examples/anonymous_transfer/anonymous.py | 2 +- examples/checksum/checksum.py | 2 +- examples/coin_flipping/coin_flipping.py | 6 +- .../eavesdropping.py | 2 +- examples/quantum_money/man_in_the_middle.py | 4 +- examples/quantum_money/q_money.py | 4 +- examples/retransmission/retransmission.py | 2 +- examples/send_data/send_data.py | 2 +- examples/send_data/send_data_no_ack.py | 2 +- examples/sniffing/sniffing.py | 2 +- examples/teleport/teleport.py | 2 +- examples/teleport/teleport_no_ack.py | 2 +- examples/teleport/teleport_with_protocol.py | 2 +- integration_tests/test_channel.py | 16 +-- integration_tests/test_host.py | 55 ++++++++-- integration_tests/test_multi_hop.py | 6 +- integration_tests/test_single_hop.py | 54 +++++----- qunetsim/backends/eqsn_backend.py | 3 +- qunetsim/components/host.py | 102 ++++++++++++++---- qunetsim/components/protocols.py | 4 +- qunetsim/objects/qubit.py | 9 +- qunetsim/objects/storage/quantum_storage.py | 18 ++-- requirements.txt | 2 +- templater.py | 2 +- 71 files changed, 324 insertions(+), 221 deletions(-) diff --git a/benchmarks/benchmark_protocols.py b/benchmarks/benchmark_protocols.py index affbb79..a59e9b1 100644 --- a/benchmarks/benchmark_protocols.py +++ b/benchmarks/benchmark_protocols.py @@ -30,7 +30,7 @@ def teleport(sender, receiver): for i in range(10): q1 = Qubit(sender) sender.send_teleport(receiver.host_id, q1, await_ack=False, no_ack=True) - q2 = receiver.get_data_qubit(sender.host_id, q1.id, wait=-1) + q2 = receiver.get_qubit(sender.host_id, q1.id, wait=-1) _ = q2.measure() diff --git a/dev_requirements.txt b/dev_requirements.txt index 056d55d..7d9d897 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -7,7 +7,7 @@ Babel==2.9.1 backcall==0.1.0 bitstring==3.1.6 bleach==3.3.0 -certifi==2019.6.16 +certifi==2022.12.7 cffi==1.14.0 chardet==3.0.4 Click==7.0 @@ -23,14 +23,14 @@ docutils==0.15.2 entrypoints==0.3 eqsn==0.0.8 flake8==3.7.9 -future==0.18.2 +future==0.18.3 hyperlink==19.0.0 idna==2.8 imagesize==1.1.0 importlib-metadata==1.1.0 incremental==17.5.0 ipykernel==5.1.3 -ipython==7.10.1 +ipython==7.16.3 ipython-genutils==0.2.0 jedi==0.15.1 jeepney==0.4.3 @@ -38,20 +38,20 @@ Jinja2==2.11.3 json5==0.8.5 jsonschema==3.2.0 jupyter-client==6.1.3 -jupyter-core==4.6.3 +jupyter-core==4.11.2 keyring==21.2.1 kiwisolver==1.1.0 MarkupSafe==1.1.1 matplotlib==3.1.2 mccabe==0.6.1 -mistune==0.8.4 +mistune==2.0.3 more-itertools==8.0.0 nbconvert==5.6.1 nbformat==4.4.0 networkx==2.4 nose2==0.9.1 -notebook==6.4.1 -numpy==1.18.1 +notebook==6.4.12 +numpy==1.22.0 packaging==19.1 pandocfilters==1.4.2 parso==0.5.1 @@ -99,7 +99,7 @@ tornado==6.0.3 tqdm==4.46.1 traitlets==4.3.3 twine==3.1.1 -Twisted==20.3.0 +Twisted==22.10.0 urllib3==1.26.5 wcwidth==0.1.7 webencodings==0.5.1 diff --git a/docs/_sources/components/host.rst.txt b/docs/_sources/components/host.rst.txt index bfac628..4b7738a 100644 --- a/docs/_sources/components/host.rst.txt +++ b/docs/_sources/components/host.rst.txt @@ -17,9 +17,9 @@ The most commonly used methods for Hosts are: * Add a classical and quantum connection to the host with id *host_id* * :code:`get_classical(host_id, wait=N)` * Get a classical message from sender with host_id *host_id* and wait *N* seconds for it -* :code:`get_data_qubit(host_id, wait=N)`: +* :code:`get_qubit(host_id, wait=N)`: * Get a data qubit from sender with host_id *host_id* and wait *N* seconds for it -* :code:`get_data_qubits(host_id)`: +* :code:`get_qubits(host_id)`: * Get all data qubits from sender with host_id *host_id* * :code:`get_epr(host_id, q_id=q_id)`: * Get EPR pair with qubit ID *q_id* from sender with host_id *host_id*. If *q_id=None* then get the first free EPR pair diff --git a/docs/_sources/examples/QKD_B92.rst.txt b/docs/_sources/examples/QKD_B92.rst.txt index 4475fc9..7aa7db1 100644 --- a/docs/_sources/examples/QKD_B92.rst.txt +++ b/docs/_sources/examples/QKD_B92.rst.txt @@ -105,7 +105,7 @@ Bob sends Alice a classical message after the measurement and tells her whether while received_counter < key_size: base = randint(0,1) # 0 means rectilinear basis and 1 means diagonal basis - qubit = bob.get_data_qubit(sender,wait = wait_time) + qubit = bob.get_qubit(sender,wait = wait_time) if qubit is not None: if base == 1: qubit.H() @@ -276,7 +276,7 @@ The full example is given below. while received_counter < key_size: base = randint(0, 1) # 0 means rectilinear basis and 1 means diagonal basis - qubit = bob.get_data_qubit(sender, wait=wait_time) + qubit = bob.get_qubit(sender, wait=wait_time) if qubit is not None: if base == 1: qubit.H() diff --git a/docs/_sources/examples/QKD_BB84.rst.txt b/docs/_sources/examples/QKD_BB84.rst.txt index 1152e54..d83e870 100644 --- a/docs/_sources/examples/QKD_BB84.rst.txt +++ b/docs/_sources/examples/QKD_BB84.rst.txt @@ -121,9 +121,9 @@ the same bit again, until the transmission works. measurement_base = random.randint(0, 1) # wait for the qubit - q_bit = eve.get_data_qubit(sender, wait=wait_time) + q_bit = eve.get_qubit(sender, wait=wait_time) while q_bit is None: - q_bit = eve.get_data_qubit(sender, wait=wait_time) + q_bit = eve.get_qubit(sender, wait=wait_time) # measure qubit in right measurement basis if measurement_base == 1: @@ -305,7 +305,7 @@ The full example is below: # wait for the qubit q_bit = eve.get_data_qubit(sender, wait=wait_time) while q_bit is None: - q_bit = eve.get_data_qubit(sender, wait=wait_time) + q_bit = eve.get_qubit(sender, wait=wait_time) # measure qubit in right measurement basis if measurement_base == 1: diff --git a/docs/_sources/examples/anonymous_transfer.rst.txt b/docs/_sources/examples/anonymous_transfer.rst.txt index b41cede..44fe495 100644 --- a/docs/_sources/examples/anonymous_transfer.rst.txt +++ b/docs/_sources/examples/anonymous_transfer.rst.txt @@ -78,7 +78,7 @@ Finally, we establish the behaviour of the receiver. The receiver here behaves a print('established secret EPR') host.add_epr(s, q, q_id=epr_id) - q = host.get_data_qubit(s, wait=10) + q = host.get_qubit(s, wait=10) host.empty_classical() print('Received qubit %s in the %d state' % (q.id, q.measure())) @@ -142,7 +142,7 @@ Full example: print('established secret EPR') host.add_epr(s, q, q_id=epr_id) - q = host.get_data_qubit(s, wait=10) + q = host.get_qubit(s, wait=10) host.empty_classical() print('Received qubit %s in the %d state' % (q.id, q.measure())) diff --git a/docs/_sources/examples/packet_sniffing.rst.txt b/docs/_sources/examples/packet_sniffing.rst.txt index 7464727..08b9278 100644 --- a/docs/_sources/examples/packet_sniffing.rst.txt +++ b/docs/_sources/examples/packet_sniffing.rst.txt @@ -56,7 +56,7 @@ her messages and measures her qubits. print("Eve Received classical: %s." % alice_message.content) for i in range(amount_to_transmit): - q = host.get_data_qubit('Alice', wait=10) + q = host.get_qubit('Alice', wait=10) m = q.measure() print("Eve measured: %d." % m) @@ -166,7 +166,7 @@ The full example is below. print("Eve Received classical: %s." % alice_message.content) for i in range(amount_transmit): - q = host.get_data_qubit('Alice', wait=10) + q = host.get_qubit('Alice', wait=10) m = q.measure() print("Eve measured: %d." % m) diff --git a/docs/_sources/examples/quantum_coin_flipping.rst.txt b/docs/_sources/examples/quantum_coin_flipping.rst.txt index df74aa0..349c0b3 100644 --- a/docs/_sources/examples/quantum_coin_flipping.rst.txt +++ b/docs/_sources/examples/quantum_coin_flipping.rst.txt @@ -78,11 +78,11 @@ received and stored in *partner_qubits*. # send and get q1 from our partner host.send_qubit(partner_id, q1, await_ack=True) - partner_q1 = host.get_data_qubit(partner_id) + partner_q1 = host.get_qubit(partner_id) # send and get q2 from our partner host.send_qubit(partner_id, q2, await_ack=True) - partner_q2 = host.get_data_qubit(partner_id) + partner_q2 = host.get_qubit(partner_id) partner_qubits[i, j, 0] = partner_q1 partner_qubits[i, j, 1] = partner_q2 @@ -124,7 +124,7 @@ and the host returns the quantum state :math:`\Psi_{\bar{a}_j}`. psi_a[i, j] = partner_qubits[i, j, 1] # The partner should send the qubit Ψ_b_j_bar back. - psi_b_bar[i, j] = host.get_data_qubit(partner_id, wait=10) + psi_b_bar[i, j] = host.get_qubit(partner_id, wait=10) After this procedure, the host has m qubits of the state :math:`\Psi_{\bar{b}_j}` and m qubits of :math:`\Psi_{a_j}`, for all j. @@ -284,11 +284,11 @@ The full example is given below. # send and get q1 from our partner host.send_qubit(partner_id, q1, await_ack=True) - partner_q1 = host.get_data_qubit(partner_id) + partner_q1 = host.get_qubit(partner_id) # send and get q2 from our partner host.send_qubit(partner_id, q2, await_ack=True) - partner_q2 = host.get_data_qubit(partner_id) + partner_q2 = host.get_qubit(partner_id) partner_qubits[i, j, 0] = partner_q1 partner_qubits[i, j, 1] = partner_q2 @@ -317,7 +317,7 @@ The full example is given below. psi_a[i, j] = partner_qubits[i, j, 1] # The partner should send the qubit Ψ_b_j_bar back. - psi_b_bar[i, j] = host.get_data_qubit(partner_id, wait=10) + psi_b_bar[i, j] = host.get_qubit(partner_id, wait=10) for j in range(m): # Send own random bits b_j to partner diff --git a/docs/_sources/examples/quantum_money.rst.txt b/docs/_sources/examples/quantum_money.rst.txt index 2fed4e8..8ccbfae 100644 --- a/docs/_sources/examples/quantum_money.rst.txt +++ b/docs/_sources/examples/quantum_money.rst.txt @@ -83,7 +83,7 @@ After the bank distributes the money, the customer possesses the money. def receive_money(): for serial in range(NO_OF_SERIALS): for bit_no in range(QUBITS_PER_MONEY): - q = host.get_data_qubit(banker, wait=10) + q = host.get_qubit(banker, wait=10) money_qubits[serial].append(q) print('Customer received money') @@ -135,7 +135,7 @@ that there is a cheating attempt. If measurement results are correct, the bank v print('Serial received by Bank') serial_to_be_checked = message.content for qubit_no in range(QUBITS_PER_MONEY): - q = host.get_data_qubit(customer, wait=10) + q = host.get_qubit(customer, wait=10) if bank_basis[serial_to_be_checked][qubit_no] == 1: q.H() @@ -240,7 +240,7 @@ The full example is below: print('Serial received by Bank') serial_to_be_checked = message.content for qubit_no in range(QUBITS_PER_MONEY): - q = host.get_data_qubit(customer, wait=10) + q = host.get_qubit(customer, wait=10) if bank_basis[serial_to_be_checked][qubit_no] == 1: q.H() @@ -272,7 +272,7 @@ The full example is below: def receive_money(): for serial in range(NO_OF_SERIALS): for bit_no in range(QUBITS_PER_MONEY): - q = host.get_data_qubit(banker, wait=10) + q = host.get_qubit(banker, wait=10) money_qubits[serial].append(q) print('Customer received money') diff --git a/docs/_sources/examples/send_data.rst.txt b/docs/_sources/examples/send_data.rst.txt index 5d86f09..def0f32 100644 --- a/docs/_sources/examples/send_data.rst.txt +++ b/docs/_sources/examples/send_data.rst.txt @@ -74,7 +74,7 @@ Dean can safely access the qubit that Alice sent without having to wait. q_id, ack_arrived = host_alice.send_qubit('Dean', q, await_ack=True) # Get the qubit on Dean's side from Alice - q_rec = host_dean.get_data_qubit('Alice', q_id, wait=0) + q_rec = host_dean.get_qubit('Alice', q_id, wait=0) # Ensure the qubit arrived and then measure and print the results. if q_rec is not None: @@ -133,7 +133,7 @@ The full example is below: q_id, _ = host_alice.send_qubit('Dean', q, await_ack=True) # Get the qubit on Dean's side from Alice - q_rec = host_dean.get_data_qubit('Alice', q_id) + q_rec = host_dean.get_qubit('Alice', q_id) # Ensure the qubit arrived and then measure and print the results. if q_rec is not None: diff --git a/docs/_sources/quick_start.rst.txt b/docs/_sources/quick_start.rst.txt index 99f3feb..9e12fcd 100644 --- a/docs/_sources/quick_start.rst.txt +++ b/docs/_sources/quick_start.rst.txt @@ -65,7 +65,7 @@ of commands that are built into hosts, see the [Design Overview section](https:/ # Here we write the protocol code for another host. for _ in range(5): # Wait for a qubit from Alice for 10 seconds. - q = host.get_data_qubit(sender, wait=10) + q = host.get_qubit(sender, wait=10) # Measure the qubit and print the result. print('%s received a qubit in the %d state.' % (host.host_id, q.measure())) diff --git a/docs/components/host.html b/docs/components/host.html index 335d814..178fb3e 100644 --- a/docs/components/host.html +++ b/docs/components/host.html @@ -244,14 +244,14 @@

Host
  • -
    get_data_qubit(host_id, wait=N):
      +
      get_qubit(host_id, wait=N):
      • Get a data qubit from sender with host_id host_id and wait N seconds for it

  • -
    get_data_qubits(host_id):
    -
    -get_data_qubit(host_id, q_id=None, wait=0)
    +
    +get_qubit(host_id, q_id=None, wait=0)

    Gets the data qubit received from another host in the network. If qubit ID is specified, qubit with that ID is returned, else, the last qubit received is returned.

    @@ -785,10 +785,10 @@

    Host

    -
    -get_data_qubits(host_id, remove_from_storage=False)
    +
    +get_qubits(host_id, remove_from_storage=False)

    Return the dictionary of data qubits stored, just for the information regarding which qubits are stored. -Optional to remove the qubits from storage like get_data_qubit does with remove_from_storage field.

    +Optional to remove the qubits from storage like get_qubit does with remove_from_storage field.

    Parameters