Skip to content

Commit

Permalink
Merge pull request #49 from tqsd/docs-update
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
stephendiadamo authored Jun 24, 2020
2 parents 7ffed57 + a432cab commit b4da42a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
Binary file modified docs/_build/.doctrees/components/host.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/environment.pickle
Binary file not shown.
24 changes: 14 additions & 10 deletions docs/_build/components/host.html
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ <h1>Host<a class="headerlink" href="#host" title="Permalink to this headline">¶
<dd><p>Gets the received classical messages sorted with the sequence number.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Sorted array of classical messages.</p>
<dd class="field-odd"><p>Sorted list of classical messages.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Array</p>
<dd class="field-even"><p>(list)</p>
</dd>
</dl>
</dd></dl>
Expand All @@ -563,13 +563,21 @@ <h1>Host<a class="headerlink" href="#host" title="Permalink to this headline">¶
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The delay per tick for the queue processor.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(float)</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="qunetsim.components.host.Host.empty_classical">
<code class="sig-name descname">empty_classical</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">reset_seq_nums</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.empty_classical" title="Permalink to this definition"></a></dt>
<dd><p>Empty the classical message buffers.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>reset_seq_nums</strong> (<em>bool</em>) – if all sequence number should also be reset.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
Expand Down Expand Up @@ -952,10 +960,10 @@ <h1>Host<a class="headerlink" href="#host" title="Permalink to this headline">¶
:type receiver_id: str</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>a two element array of the status of the removals.</p>
<dd class="field-odd"><p>a two element list of the status of the removals.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>list</p>
<dd class="field-even"><p>(list)</p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -1091,14 +1099,10 @@ <h1>Host<a class="headerlink" href="#host" title="Permalink to this headline">¶
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Qubit which belongs to the host and is part of the</dt><dd><p>GHZ state and ID which all Qubits will have.</p>
</dd>
</dl>
</p>
<dd class="field-even"><p>Qubit ID of the shared GHZ and ACK status</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>Q_id, <a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit">Qubit</a></p>
<dd class="field-odd"><p>(str, bool)</p>
</dd>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/searchindex.js

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions qunetsim/components/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ def classical(self):
Gets the received classical messages sorted with the sequence number.
Returns:
Array: Sorted array of classical messages.
(list): Sorted list of classical messages.
"""
return sorted(self._classical_messages.get_all(), key=lambda x: x.seq_num, reverse=True)

def empty_classical(self, reset_seq_nums=False):
"""
Empty the classical message buffers.
Args:
reset_seq_nums (bool): if all sequence number should also be reset.
"""
if reset_seq_nums:
self.reset_sequence_numbers()
Expand All @@ -120,7 +123,7 @@ def delay(self):
Get the delay of the queue processor.
Returns:
The delay per tick for the queue processor.
(float): The delay per tick for the queue processor.
"""
return self._delay

Expand All @@ -131,7 +134,6 @@ def delay(self, delay):
Args:
delay (float): The delay per tick for the queue processor.
"""
if not (isinstance(delay, int) or isinstance(delay, float)):
raise Exception('delay should be a number')
Expand Down Expand Up @@ -636,7 +638,7 @@ def remove_connection(self, receiver_id):
receiver_id (str): The ID of the connection to remove
Returns:
list: a two element array of the status of the removals.
(list): a two element list of the status of the removals.
"""
c = self.remove_c_connection(receiver_id)
q = self.remove_q_connection(receiver_id)
Expand Down Expand Up @@ -882,8 +884,7 @@ def send_ghz(self, receiver_list, q_id=None, await_ack=False, no_ack=False, dist
distribute (bool): If the sender should keep part of the GHZ state, or just
distribute one
Returns:
Q_id, Qubit: Qubit which belongs to the host and is part of the
GHZ state and ID which all Qubits will have.
(str, bool): Qubit ID of the shared GHZ and ACK status
"""
own_qubit = Qubit(self, q_id=q_id)
q_id = own_qubit.id
Expand Down Expand Up @@ -928,7 +929,6 @@ def send_ghz(self, receiver_list, q_id=None, await_ack=False, no_ack=False, dist
if self.await_ack(seq_num, receiver_id) is False:
ret = False
return q_id, ret

return q_id

def get_ghz(self, host_id, q_id=None, wait=0):
Expand Down Expand Up @@ -959,6 +959,7 @@ def send_teleport(self, receiver_id, q, await_ack=False, no_ack=False, payload=N
no_ack (bool): If this message should not use any ACK and sequencing.
payload:
generate_epr_if_none: Generate an EPR pair with receiver if one doesn't exist
Returns:
(bool) If await_ack=True, return the status of the ACK
"""
Expand Down

0 comments on commit b4da42a

Please sign in to comment.