Skip to content

Commit ffc5352

Browse files
authored
Remove unnecessary conditional (#3401)
`state_like` is definitely a numpy array (see if statement on line 304).
1 parent 0b61039 commit ffc5352

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cirq/qis/states.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,12 @@ def _state_like_to_state_tensor(*, state_like: 'cirq.STATE_VECTOR_LIKE',
305305
prod = np.prod(qid_shape, dtype=int)
306306

307307
if len(qid_shape) == prod:
308-
if (not isinstance(state_like, np.ndarray) or
309-
state_like.dtype.kind != 'c'):
308+
if state_like.dtype.kind != 'c':
310309
raise ValueError(
311310
'Because len(qid_shape) == product(qid_shape), it is '
312-
'ambiguous whether or not the given `state_like` is a '
313-
'state vector or a list of computational basis values for '
314-
'the qudits. In this situation you are required to pass '
311+
'ambiguous whether the given `state_like` contains '
312+
'state vector amplitudes or per-qudit computational basis '
313+
'values. In this situation you are required to pass '
315314
'in a state vector that is a numpy array with a complex '
316315
'dtype.')
317316

0 commit comments

Comments
 (0)