@@ -55,17 +55,18 @@ def __str__(self):
5555class QuantumEngine (pb .Referenceable , abc .ABC ):
5656 """
5757 Basic quantum engine. Abstract class meant to be subclassed to implement different simulation backends.
58-
59- Attributes:
60- Arguments
61- node node this register is started from
62- num number of this register
63- maxQubits maximum number of qubits this register supports
6458 """
6559
6660 def __init__ (self , node : str , num : int , maxQubits : int = 10 ):
6761 """
68- Initialize the simple engine. If no number is given for maxQubits, the assumption will be 10.
62+ Initialize the simple engine.
63+
64+ :param node: Node name this register is started from.
65+ :type node: str
66+ :param num: Number of this register.
67+ :type num: int
68+ :param maxQubits: maximum number of qubits this register supports. If not give, it will default to 10.
69+ :type maxQubits: int
6970 """
7071
7172 self .maxQubits = maxQubits
@@ -80,7 +81,8 @@ def __init__(self, node: str, num: int, maxQubits: int = 10):
8081 @abc .abstractmethod
8182 def add_fresh_qubit (self ) -> int :
8283 """
83- Add a new qubit initialized in the |0> state.
84+ Add a new qubit initialized in the :math:`|0>` state.
85+
8486 :return: The qubit number
8587 :rtype: int
8688 """
@@ -90,6 +92,9 @@ def add_fresh_qubit(self) -> int:
9092 def add_qubit (self , newQubit ) -> int :
9193 """
9294 Add new qubit in the state described by the density matrix newQubit
95+
96+ :param newQubit: The new qubit state
97+ :type newQubit: Any
9398 :return: The qubit number
9499 :rtype: int
95100 """
@@ -99,6 +104,9 @@ def add_qubit(self, newQubit) -> int:
99104 def remove_qubit (self , qubitNum : int ) -> None :
100105 """
101106 Removes the qubit with the desired number qubitNum
107+
108+ :param qubitNum: Qubit number
109+ :type qubitNum: int
102110 :rtype: None
103111 """
104112 pass
@@ -117,8 +125,9 @@ def get_register_RI(self):
117125 def get_density_matrix_RI (self ):
118126 """
119127 Retrieves the entire register in real and imaginary parts and returns the result of
120- the outer product. In other words, if the qubit is in state |q>, this function
121- returns the density matrix |q><q| of the qubit.
128+ the outer product. In other words, if the qubit is in state :math:`|q>`, this function
129+ returns the density matrix :math:`|q><q|` of the qubit.
130+
122131 :return: The density matrix real and imaginary parts of a qubit state
123132 """
124133 pass
@@ -127,6 +136,9 @@ def get_density_matrix_RI(self):
127136 def apply_H (self , qubitNum ):
128137 """
129138 Applies a Hadamard gate to the qubits with number qubitNum.
139+
140+ :param qubitNum: Qubit number
141+ :type qubitNum: int
130142 :rtype: None
131143 """
132144 pass
@@ -135,14 +147,20 @@ def apply_H(self, qubitNum):
135147 def apply_K (self , qubitNum ):
136148 """
137149 Applies a K gate to the qubits with number qubitNum. Maps computational basis to Y eigenbasis.
150+
151+ :param qubitNum: Qubit number
152+ :type qubitNum: int
138153 :rtype: None
139154 """
140155 pass
141156
142157 @abc .abstractmethod
143158 def apply_X (self , qubitNum ):
144159 """
145- Applies a X gate to the qubits with number qubitNum.
160+ Applies an X gate to the qubits with number qubitNum.
161+
162+ :param qubitNum: Qubit number
163+ :type qubitNum: int
146164 :rtype: None
147165 """
148166 pass
@@ -151,6 +169,9 @@ def apply_X(self, qubitNum):
151169 def apply_Z (self , qubitNum ):
152170 """
153171 Applies a Z gate to the qubits with number qubitNum.
172+
173+ :param qubitNum: Qubit number
174+ :type qubitNum: int
154175 :rtype: None
155176 """
156177 pass
@@ -159,6 +180,9 @@ def apply_Z(self, qubitNum):
159180 def apply_Y (self , qubitNum ):
160181 """
161182 Applies a Y gate to the qubits with number qubitNum.
183+
184+ :param qubitNum: Qubit number
185+ :type qubitNum: int
162186 :rtype: None
163187 """
164188 pass
@@ -167,6 +191,9 @@ def apply_Y(self, qubitNum):
167191 def apply_T (self , qubitNum ):
168192 """
169193 Applies a T gate to the qubits with number qubitNum.
194+
195+ :param qubitNum: Qubit number
196+ :type qubitNum: int
170197 :rtype: None
171198 """
172199 pass
@@ -177,12 +204,12 @@ def apply_rotation(self, qubitNum, n, a):
177204 Applies a rotation around the axis n with the angle a to qubit with number qubitNum. If n is zero a ValueError
178205 is raised.
179206
180- :param qubitNum: int
181- Qubit number
182- :param n: tuple
183- A tuple of three numbers specifying the rotation axis, e.g n=(1,0,0)
184- :param a: float
185- The rotation angle in radians.
207+ :param qubitNum: Qubit number
208+ :type qubitNum: int
209+ :param n: A tuple of three numbers specifying the rotation axis, e.g n=(1,0,0)
210+ :type n: Tuple[int, int, int]
211+ :param a: The rotation angle in radians.
212+ :type a: float
186213 :rtype: None
187214 """
188215 pass
@@ -191,6 +218,11 @@ def apply_rotation(self, qubitNum, n, a):
191218 def apply_CNOT (self , qubitNum1 , qubitNum2 ):
192219 """
193220 Applies the CNOT to the qubit with the numbers qubitNum1 and qubitNum2.
221+
222+ :param qubitNum1: Qubit number 1
223+ :type qubitNum1: int
224+ :param qubitNum2: Qubit number 2
225+ :type qubitNum2: int
194226 :rtype: None
195227 """
196228 pass
@@ -199,6 +231,11 @@ def apply_CNOT(self, qubitNum1, qubitNum2):
199231 def apply_CPHASE (self , qubitNum1 , qubitNum2 ):
200232 """
201233 Applies the CPHASE to the qubit with the numbers qubitNum1 and qubitNum2.
234+
235+ :param qubitNum1: Qubit number 1
236+ :type qubitNum1: int
237+ :param qubitNum2: Qubit number 2
238+ :type qubitNum2: int
202239 :rtype: None
203240 """
204241 pass
@@ -208,9 +245,10 @@ def apply_onequbit_gate(self, gateU, qubitNum):
208245 """
209246 Applies a unitary gate to the specified qubit.
210247
211- Arguments:
212- gateU unitary to apply as Qobj
213- qubitNum the number of the qubit this gate is applied to
248+ :param gateU: Unitary to apply as Qobj
249+ :type gateU: Qobj
250+ :param qubitNum: The number of the qubit this gate is applied to
251+ :type qubitNum: int
214252 :rtype: None
215253 """
216254 pass
@@ -220,10 +258,12 @@ def apply_twoqubit_gate(self, gateU, qubit1, qubit2):
220258 """
221259 Applies a unitary gate to the two specified qubits.
222260
223- Arguments:
224- gateU unitary to apply as Qobj
225- qubit1 the first qubit
226- qubit2 the second qubit
261+ :param gateU: Unitary to apply as Qobj
262+ :type gateU: Qobj
263+ :param qubit1: The first qubit
264+ :type qubit1: int
265+ :param qubit2: The second qubit
266+ :type qubit2: int
227267 :rtype: None
228268 """
229269 pass
@@ -234,9 +274,9 @@ def measure_qubit_inplace(self, qubitNum):
234274 Measures the desired qubit in the standard basis. This returns the classical outcome. The quantum register
235275 is in the post-measurment state corresponding to the obtained outcome.
236276
237- Arguments:
238- qubitNum qubit to be measured
239- :return: The meaurement outcome
277+ :param qubitNum: Qubit to be measured
278+ :type qubitNum: int
279+ :return: The measurement outcome
240280 :rtype: int
241281 """
242282 pass
@@ -246,9 +286,9 @@ def measure_qubit(self, qubitNum):
246286 """
247287 Measures the desired qubit in the standard basis. This returns the classical outcome and deletes the qubit.
248288
249- Arguments:
250- qubitNum qubit to be measured
251- :return: The meaurement outcome
289+ :param qubitNum: Qubit to be measured
290+ :type qubitNum: int
291+ :return: The measurement outcome
252292 :rtype: int
253293 """
254294 pass
@@ -257,6 +297,11 @@ def measure_qubit(self, qubitNum):
257297 def replace_qubit (self , qubitNum , state ):
258298 """
259299 Replaces the qubit at position qubitNum with the one given by state.
300+
301+ :param qubitNum: Qubit to be replaced
302+ :type qubitNum: int
303+ :param state: New state to write in the place of the old qubit.
304+ :type state: Any
260305 :rtype: None
261306 """
262307 pass
@@ -265,6 +310,9 @@ def replace_qubit(self, qubitNum, state):
265310 def absorb (self , other ):
266311 """
267312 Absorb the qubits from the other engine into this one. This is done by tensoring the state at the end.
313+
314+ :param other: The other qubit to absorb.
315+ :type other: int
268316 :rtype: None
269317 """
270318 pass
@@ -274,10 +322,11 @@ def absorb_parts(self, R, I, activeQ):
274322 """
275323 Absorb the qubits, given in pieces
276324
277- Arguments:
278- R real part of the qubit state as a list
279- I imaginary part as a list
280- activeQ active number of qubits
325+ :param R: Real part of the qubit state as a list.
326+ :type R: List[float]
327+ :param I: Imaginary part as a list.
328+ :type I: List[float]
329+ :param activeQ: Active number of qubits
281330 :rtype: None
282331 """
283332 pass
0 commit comments