From b4bc8881284aadfcb72974aa40d25889cd54a2fa Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 20:57:03 -0700 Subject: [PATCH] Clarify expected values in `ones` and `ones_like` when `dtype` is a complex number data type --- spec/API_specification/array_api/creation_functions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/API_specification/array_api/creation_functions.py b/spec/API_specification/array_api/creation_functions.py index 65244cf97..1e632da2e 100644 --- a/spec/API_specification/array_api/creation_functions.py +++ b/spec/API_specification/array_api/creation_functions.py @@ -270,6 +270,9 @@ def ones(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, d """ Returns a new array having a specified ``shape`` and filled with ones. + .. note:: + An output array having a complex floating-point data type must contain complex numbers having a real component equal to one and an imaginary component equal to zero (i.e., ``1 + 0j``). + Parameters ---------- shape: Union[int, Tuple[int, ...]] @@ -289,6 +292,9 @@ def ones_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[de """ Returns a new array filled with ones and having the same ``shape`` as an input array ``x``. + .. note:: + An output array having a complex floating-point data type must contain complex numbers having a real component equal to one and an imaginary component equal to zero (i.e., ``1 + 0j``). + Parameters ---------- x: array