Skip to content

Commit b4bc888

Browse files
committed
Clarify expected values in ones and ones_like when dtype is a complex number data type
1 parent fc77b0a commit b4bc888

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
@@ -270,6 +270,9 @@ def ones(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, d
270270
"""
271271
Returns a new array having a specified ``shape`` and filled with ones.
272272
273+
.. note::
274+
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``).
275+
273276
Parameters
274277
----------
275278
shape: Union[int, Tuple[int, ...]]
@@ -289,6 +292,9 @@ def ones_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[de
289292
"""
290293
Returns a new array filled with ones and having the same ``shape`` as an input array ``x``.
291294
295+
.. note::
296+
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``).
297+
292298
Parameters
293299
----------
294300
x: array

0 commit comments

Comments
 (0)