Skip to content

Commit d3e5067

Browse files
authored
Merge pull request #126 from ev-br/real_conj_numeric
ENH: real and conj accept numeric dtypes
2 parents dd3a06f + 7e93970 commit d3e5067

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

array_api_strict/_elementwise_functions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ def conj(x: Array, /) -> Array:
378378
379379
See its docstring for more information.
380380
"""
381-
if x.dtype not in _complex_floating_dtypes:
382-
raise TypeError("Only complex floating-point dtypes are allowed in conj")
381+
if x.dtype not in _numeric_dtypes:
382+
raise TypeError("Only numeric dtypes are allowed in conj")
383383
return Array._new(np.conj(x._array), device=x.device)
384384

385385

@@ -568,8 +568,8 @@ def real(x: Array, /) -> Array:
568568
569569
See its docstring for more information.
570570
"""
571-
if x.dtype not in _complex_floating_dtypes:
572-
raise TypeError("Only complex floating-point dtypes are allowed in real")
571+
if x.dtype not in _numeric_dtypes:
572+
raise TypeError("Only numeric dtypes are allowed in real")
573573
return Array._new(np.real(x._array), device=x.device)
574574

575575

array_api_strict/tests/test_elementwise_functions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def nargs(func):
5252
"bitwise_xor": "integer or boolean",
5353
"ceil": "real numeric",
5454
"clip": "real numeric",
55-
"conj": "complex floating-point",
55+
"conj": "numeric",
5656
"copysign": "real floating-point",
5757
"cos": "floating-point",
5858
"cosh": "floating-point",
@@ -88,7 +88,7 @@ def nargs(func):
8888
"not_equal": "all",
8989
"positive": "numeric",
9090
"pow": "numeric",
91-
"real": "complex floating-point",
91+
"real": "numeric",
9292
"reciprocal": "floating-point",
9393
"remainder": "real numeric",
9494
"round": "numeric",

0 commit comments

Comments
 (0)