Skip to content

Commit 1a74a80

Browse files
committed
Avoid a construct deprecated in NumPy 2
The NumPy 2 Migration Guide [explicitly recommends changing](https://numpy.org/doc/stable/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword) constructs of the form ```python np.array(state, copy=False) ``` to ```python np.asarray(state) ```
1 parent c6b396e commit 1a74a80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cirq-core/cirq/qis/states.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def quantum_state(
264264
dtype = DEFAULT_COMPLEX_DTYPE
265265
data = one_hot(index=state, shape=(dim,), dtype=dtype)
266266
else:
267-
data = np.array(state, copy=False)
267+
data = np.asarray(state)
268268
if qid_shape is None:
269269
qid_shape = infer_qid_shape(state)
270270
if data.ndim == 1 and data.dtype.kind != 'c':

0 commit comments

Comments
 (0)