From b18a1b6e487041c439844a83358bb6fa6afcaf8f Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Fri, 7 Feb 2025 11:03:40 +0100 Subject: [PATCH] ENH: real and conj accept numeric dtypes --- array_api_strict/_elementwise_functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/array_api_strict/_elementwise_functions.py b/array_api_strict/_elementwise_functions.py index 54691d6..c11b17c 100644 --- a/array_api_strict/_elementwise_functions.py +++ b/array_api_strict/_elementwise_functions.py @@ -378,8 +378,8 @@ def conj(x: Array, /) -> Array: See its docstring for more information. """ - if x.dtype not in _complex_floating_dtypes: - raise TypeError("Only complex floating-point dtypes are allowed in conj") + if x.dtype not in _numeric_dtypes: + raise TypeError("Only numeric dtypes are allowed in conj") return Array._new(np.conj(x._array), device=x.device) @@ -568,8 +568,8 @@ def real(x: Array, /) -> Array: See its docstring for more information. """ - if x.dtype not in _complex_floating_dtypes: - raise TypeError("Only complex floating-point dtypes are allowed in real") + if x.dtype not in _numeric_dtypes: + raise TypeError("Only numeric dtypes are allowed in real") return Array._new(np.real(x._array), device=x.device)