From d58dd70c5f9deaf12af9cd4c36dc8bb719819a9b Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 22:14:42 -0700 Subject: [PATCH] Clarify expected behavior when providing a complex number array to `nonzero` --- spec/API_specification/array_api/searching_functions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/API_specification/array_api/searching_functions.py b/spec/API_specification/array_api/searching_functions.py index 37da37e24..a76b03f63 100644 --- a/spec/API_specification/array_api/searching_functions.py +++ b/spec/API_specification/array_api/searching_functions.py @@ -42,6 +42,12 @@ def nonzero(x: array, /) -> Tuple[array, ...]: """ Returns the indices of the array elements which are non-zero. + .. note:: + If ``x`` has a complex floating-point data type, non-zero elements are those elements having at least one component (real or imaginary) which is non-zero. + + .. note:: + If ``x`` has a boolean data type, non-zero elements are those elements which are equal to ``True``. + .. admonition:: Data-dependent output shape :class: admonition important