Skip to content

Commit b92c2fc

Browse files
committed
Fix warnings when compiling python docs
1 parent 86966af commit b92c2fc

File tree

11 files changed

+69
-77
lines changed

11 files changed

+69
-77
lines changed

docs/simulaqron.netqasm_backend.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
simulaqron.netqasm_backend package
2-
======================
2+
==================================
33

44
Submodules
55
----------

docs/simulaqron.sdk.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ simulaqron.sdk.socket module
3131
Module contents
3232
---------------
3333

34-
.. automodule:: simulaqron.run
34+
.. automodule:: simulaqron.sdk
3535
:members:
3636
:undoc-members:
3737
:show-inheritance:

docs/simulaqron.settings.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ simulaqron.settings package
44
Submodules
55
----------
66

7-
simulaqron.settings.network module
8-
----------------------------------
7+
simulaqron.settings.network_config module
8+
-----------------------------------------
99

10-
.. automodule:: simulaqron.settings.network
10+
.. automodule:: simulaqron.settings.network_config
1111
:members:
1212
:undoc-members:
1313
:show-inheritance:
@@ -24,7 +24,7 @@ simulaqron.settings.simulaqron_config module
2424
Module contents
2525
---------------
2626

27-
.. automodule:: simulaqron.run
27+
.. automodule:: simulaqron.settings
2828
:members:
2929
:undoc-members:
3030
:show-inheritance:

docs/simulaqron.start.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ simulaqron.start.start_vnode module
2323
Module contents
2424
---------------
2525

26-
.. automodule:: simulaqron.run
26+
.. automodule:: simulaqron.start
2727
:members:
2828
:undoc-members:
2929
:show-inheritance:

docs/simulaqron.virtual_node.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ simulaqron.virtual_node.qutip_simulator module
3737
:show-inheritance:
3838

3939
simulaqron.virtual_node.stabilizer_simulator module
40-
--------------------------------------------------
40+
---------------------------------------------------
4141

4242
.. automodule:: simulaqron.virtual_node.stabilizer_simulator
4343
:members:

simulaqron/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def assemble_qubit(realM: np.ndarray, imagM: np.ndarray) -> np.ndarray:
99
:type realM: np.ndarray
1010
:param imagM: Imaginary component of the qubit.
1111
:type imagM: np.ndarray
12-
:return: Assembled qubit as vector of :py:type:`complex` numbers.
12+
:return: Assembled qubit as vector of complex numbers.
1313
:rtype: np.array
1414
"""
1515
# We need this since Twisted PB does not support sending complex valued object natively.

simulaqron/netqasm_backend/executioner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def __init__(self, executioner):
4545
in order to use the correct framework as used by the netqasm executioner.
4646
4747
.. warning:: This class is candidate to be deleted! Test and delete if not needed!
48+
4849
"""
4950
self._executioner = executioner
5051
self._sockets: Dict[int, Tuple[int, int]] = {}
@@ -301,6 +302,7 @@ def get_virt_qubit(self, qubit_id: int) -> Referenceable:
301302
If not found, raises a :py:class:`UnknownQubitError`.
302303
303304
.. Caution:: Twisted PB does not allow references to objects to be passed back between connections.
305+
304306
If you need to pass a qubit reference back to the Twisted PB on a _different_ connection,
305307
then use get_virt_qubit_indep below.
306308
@@ -318,6 +320,7 @@ def get_virt_qubit(self, qubit_id: int) -> Referenceable:
318320
def get_virt_qubit_num(self, qubit_id: int):
319321
"""
320322
Get the *integer* qubit ID to virtual qubit in SimulaQron specific to this connection.
323+
321324
.. caution:: This method return a qubit ID (an integer), not a ``twisted.spread.flavors.Referenceable``
322325
object. If you need to get a twisted object, check :py:meth:`get_virt_qubit`.
323326

simulaqron/settings/simulaqron_config.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,18 @@ def default_settings(self):
144144
"""
145145
Resets the current SimulaQron configuration object to its default configuration set.
146146
The default configuration is:
147-
* max_qubits = 20
148-
* max_registers = 1000
149-
* conn_retry_time = 0.5
150-
* conn_max_retries = 10
151-
* recv_timeout = 100
152-
* recv_retry_time = 0.1
153-
* recv_max_retries = 10
154-
* log_level = logging.WARNING
155-
* sim_backend = SimBackend.STABILIZER
156-
* noisy_qubits = False
157-
* max_app_waiting_time = -1.0 # In seconds, negative means unlimited waiting
158-
* t1: float = 1.0
147+
* max_qubits = 20
148+
* max_registers = 1000
149+
* conn_retry_time = 0.5
150+
* conn_max_retries = 10
151+
* recv_timeout = 100
152+
* recv_retry_time = 0.1
153+
* recv_max_retries = 10
154+
* log_level = logging.WARNING
155+
* sim_backend = SimBackend.STABILIZER
156+
* noisy_qubits = False
157+
* max_app_waiting_time = -1.0 # In seconds, negative means unlimited waiting
158+
* t1: float = 1.0
159159
"""
160160
default_config = SimulaqronConfig()
161161
cls_fields = fields(self.__class__)

simulaqron/toolbox/stabilizer_states.py

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -29,59 +29,49 @@ def __init__(self, data=None, check_symplectic: bool = True):
2929
Clifford operations and Pauli-measurements.
3030
3131
If check_symplectic=True then a check will be made that all stabilizers commute, by checking
32-
That the matrix is symplectic. Otherwise no check is made.
33-
34-
:param data:
35-
Can be one of the following:
36-
37-
A binary array of rank 2:
38-
A binary array representing the generators of the stabilizer group.
39-
If the array is n-by-2n a stabilizer state on n qubits will be represented.
40-
The n first columns are the X-stabilizers and the n last the Z-stabilizer.
41-
If the array is n-by-(2n+1), the last column is seen as the phase for each generator
42-
as follows:
43-
0 -> 1
44-
1 -> -1
45-
46-
An array of rank 1 containing 'str':
47-
Then each string is assumed to be a generator as for example "XXZIY"
48-
Note that each string in the array should have the same length.
49-
If the number of strings is 'n' then a stabilizer state on 'n' qubits is created.
50-
If the strings have length 'n' then it is assumed that the phase is '+1'.
51-
An explicit phase can be added to the start of the string as for example: "-1XXXY".
52-
Creating a Bell-pair:
53-
StabilizerState(["XX", "ZZ"]) # The state (|00> + |11>) / sqrt(2)
54-
55-
'None' (default):
56-
Then this is seen as a stabilizer state on no qubits, i.e. a complex number.
57-
To add a qubit to such a state one can do:
58-
s = StabilizerState()
59-
s.add_qubit() # This is now in the state |0>
60-
61-
'int':
62-
Then a stabilizer state on this many qubits are created, all in the state |0> as:
63-
StabilizerState(5) # This is the then the state |00000>
64-
65-
'networkx.Graph':
66-
Then the graph state corresponding to this graph will be created.
67-
This assumes that the nodes are numbered from 0 to n - 1, where n is the number of nodes.
68-
For example:
69-
StabilizerState(networkx.complete_graph(5)) # Single qubit Clifford equiv. to a GHZ state
32+
That the matrix is symplectic. Otherwise, no check is made.
7033
7134
Examples:
72-
A qubit in the state |0> can be created as:
73-
StabilizerState([[0, 1]])
74-
75-
A qubit in the state |1> can be created as:
76-
StabilizerState([[0, 1, 1]])
77-
78-
The entangled state (|00> + |11>)/sqrt(2) can be created as:
79-
StabilizerState([[1, 1, 0, 0],
80-
0, 0, 1, 1]])
81-
82-
The entangled state (|01> + |10>)/sqrt(2) can be created as:
83-
StabilizerState([[1, 1, 0, 0, 0],
84-
0, 0, 1, 1, 1]])
35+
A qubit in the state :math:`|0>` can be created as ``StabilizerState([[0, 1]])``.
36+
37+
A qubit in the state :math:`|1>` can be created as ``StabilizerState([[0, 1, 1]])``.
38+
39+
The entangled state :math:`(|00> + |11>)/\sqrt(2)` can be created as
40+
``StabilizerState([[1, 1, 0, 0], [0, 0, 1, 1]])``.
41+
42+
The entangled state :math:`(|01> + |10>)/\sqrt(2)` can be created as
43+
``StabilizerState([[1, 1, 0, 0, 0], [0, 0, 1, 1, 1]])``.
44+
45+
:param data: Can be one of the following:
46+
47+
* A binary array of rank 2 representing the generators of the stabilizer group.
48+
If the array is n-by-2n a stabilizer state on n qubits will be represented.
49+
The n first columns are the X-stabilizers and the n last the Z-stabilizer.
50+
If the array is n-by-(2n+1), the last column is seen as the phase for each generator
51+
as follows:
52+
0 -> 1
53+
1 -> -1
54+
* An array of rank 1 containing ``str``:
55+
Then each string is assumed to be a generator as for example ``XXZIY``
56+
Note that each string in the array should have the same length.
57+
If the number of strings is ``n`` then a stabilizer state on ``n`` qubits is created.
58+
If the strings have length ``n`` then it is assumed that the phase is ``+1``.
59+
An explicit phase can be added to the start of the string as for example: ``-1XXXY``.
60+
Creating a Bell-pair:
61+
``StabilizerState(["XX", "ZZ"]) # The state (|00> + |11>) / sqrt(2)``
62+
* ``None`` (default):
63+
Then this is seen as a stabilizer state on no qubits, i.e. a complex number.
64+
To add a qubit to such a state one can do:
65+
``s = StabilizerState()``
66+
``s.add_qubit() # This is now in the state |0>``
67+
* ``int``:
68+
Then a stabilizer state on this many qubits are created, all in the state :math:`|0>` as:
69+
``StabilizerState(5) # This is the then the state |00000>``
70+
* ``networkx.Graph``:
71+
Then the graph state corresponding to this graph will be created.
72+
This assumes that the nodes are numbered from 0 to n - 1, where n is the number of nodes.
73+
For example:
74+
``StabilizerState(networkx.complete_graph(5)) # Single qubit Clifford equiv. to a GHZ state``
8575
:param check_symplectic: Whether to check if all stabilizers commute or not.
8676
:type check_symplectic: bool
8777
"""

simulaqron/virtual_node/qutip_simulator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@
4545

4646
class QutipEngine(QuantumEngine):
4747
"""
48-
Basic quantum engine which uses QuTip. Works with density matrices and in principle allows full quantum
49-
dynamics via QuTip. Subsequently, this is quite slow.
48+
Basic quantum engine which uses QuTip. Works with density matrices and in principle allows
49+
full quantum dynamics via QuTip. Subsequently, this is quite slow.
5050
"""
51-
5251
def __init__(self, node: str, num: int, maxQubits: int = 10):
5352
"""
54-
Initialize the Qutip engine.
53+
Initializes the Qutip engine
5554
5655
:param node: Node name this register is started from.
5756
:type node: str

0 commit comments

Comments
 (0)