Skip to content

Commit 977d2ed

Browse files
committed
ENH: allow complex inputs in std and var
1 parent 08dbe3a commit 977d2ed

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

array_api_strict/_statistical_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ def std(
153153
keepdims: bool = False,
154154
) -> Array:
155155
# Note: the keyword argument correction is different here
156-
if x.dtype not in _real_floating_dtypes:
157-
raise TypeError("Only real floating-point dtypes are allowed in std")
156+
if x.dtype not in _floating_dtypes:
157+
raise TypeError("Only floating-point dtypes are allowed in std")
158158
return Array._new(np.std(x._array, axis=axis, ddof=correction, keepdims=keepdims), device=x.device)
159159

160160

@@ -185,6 +185,6 @@ def var(
185185
keepdims: bool = False,
186186
) -> Array:
187187
# Note: the keyword argument correction is different here
188-
if x.dtype not in _real_floating_dtypes:
189-
raise TypeError("Only real floating-point dtypes are allowed in var")
188+
if x.dtype not in _floating_dtypes:
189+
raise TypeError("Only floating-point dtypes are allowed in var")
190190
return Array._new(np.var(x._array, axis=axis, ddof=correction, keepdims=keepdims), device=x.device)

0 commit comments

Comments
 (0)