Skip to content

Commit 9a0960a

Browse files
authored
Clarify expected values in ones and ones_like when dtype is a complex number data type (#438)
1 parent 454398d commit 9a0960a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/API_specification/array_api/creation_functions.py

+6
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ def ones(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, d
273273
"""
274274
Returns a new array having a specified ``shape`` and filled with ones.
275275
276+
.. note::
277+
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``).
278+
276279
Parameters
277280
----------
278281
shape: Union[int, Tuple[int, ...]]
@@ -292,6 +295,9 @@ def ones_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[de
292295
"""
293296
Returns a new array filled with ones and having the same ``shape`` as an input array ``x``.
294297
298+
.. note::
299+
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``).
300+
295301
Parameters
296302
----------
297303
x: array

0 commit comments

Comments
 (0)