Browse code

Fix some minor typos

Joseph Weston authored on 01/11/2023 04:33:23
Showing 3 changed files
... ...
@@ -3,3 +3,5 @@
3 3
 __version__ = "0.1.0.dev0"
4 4
 
5 5
 from qsim import state, gate, measurement
6
+
7
+__all__ = ["state", "gate", "measurement"]
... ...
@@ -38,7 +38,8 @@ def apply(op, qubits, state):
38 38
     # qubit corresponds to the *last* axis in the tensor etc.)
39 39
     qubit_axes = tuple(n_state_qubits - 1 - np.asarray(qubits))
40 40
 
41
-    # Applying the op to the state vector is then the tensor product over the appropriate axes
41
+    # Applying the op to the state vector is then the tensor product over the
42
+    # appropriate axes.
42 43
     axes = (np.arange(n_op_qubits, 2 * n_op_qubits), qubit_axes)
43 44
     new_state = np.tensordot(op, state, axes=axes)
44 45
 
... ...
@@ -68,7 +68,7 @@ def _check_valid_state(state):
68 68
         isinstance(state, np.ndarray)
69 69
         # is complex
70 70
         and np.issubdtype(state.dtype, np.complex128)
71
-        # is square
71
+        # is a vector
72 72
         and len(state.shape) == 1
73 73
         # has size 2**n, n > 1
74 74
         and np.log2(state.shape[0]).is_integer()