Browse code

Add docstring to qsim.gate.apply

Joseph Weston authored on 15/11/2019 21:14:53
Showing 1 changed files
... ...
@@ -30,6 +30,19 @@ __all__ = [
30 30
 
31 31
 
32 32
 def apply(gate, qubits, state):
33
+    """Apply a gate to the specified qubits of a state
34
+
35
+    Parameters
36
+    ----------
37
+    gate : ndarray[complex]
38
+    qubits : sequence of int
39
+        The qubits on which to act. Qubit 0 is the least significant qubit.
40
+    state : ndarray[complex]
41
+
42
+    Returns
43
+    -------
44
+    new_state : ndarray[complex]
45
+    """
33 46
     n_gate_qubits = gate.shape[0].bit_length() - 1
34 47
     n_state_qubits = state.shape[0].bit_length() - 1
35 48
     assert len(qubits) == n_gate_qubits