... | ... |
@@ -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() |