Skip to content

Commit

Permalink
fix check for whether dtype is complex
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Sep 20, 2023
1 parent e799a70 commit cb2cc9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/ffsim/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb2cc9d

Please sign in to comment.