From cb2cc9d1b672c9eccf1e0464e7a10aaf0ca68082 Mon Sep 17 00:00:00 2001 From: "Kevin J. Sung" Date: Tue, 19 Sep 2023 21:04:55 -0400 Subject: [PATCH] fix check for whether dtype is complex --- python/ffsim/random.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ffsim/random.py b/python/ffsim/random.py index 8df2bc0ae..3ba3dd4fd 100644 --- a/python/ffsim/random.py +++ b/python/ffsim/random.py @@ -27,7 +27,7 @@ def random_statevector(dim: int, *, seed=None, dtype=complex) -> np.ndarray: """ rng = np.random.default_rng(seed) vec = rng.standard_normal(dim).astype(dtype, copy=False) - if np.iscomplexobj(dtype): + if np.issubdtype(dtype, np.complexfloating): vec += 1j * rng.standard_normal(dim).astype(dtype, copy=False) vec /= np.linalg.norm(vec) return vec