Skip to content

Commit a818400

Browse files
committed
fix: update signature to indicate complex scalar support
1 parent 1e11828 commit a818400

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def __abs__(self: array, /) -> array:
148148
Added complex data type support.
149149
"""
150150

151-
def __add__(self: array, other: Union[int, float, array], /) -> array:
151+
def __add__(self: array, other: Union[int, float, complex, array], /) -> array:
152152
"""
153153
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
154154
@@ -167,8 +167,7 @@ def __add__(self: array, other: Union[int, float, array], /) -> array:
167167
Notes
168168
-----
169169
170-
.. note::
171-
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.add`.
170+
- Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.add`.
172171
173172
.. versionchanged:: 2022.12
174173
Added complex data type support.
@@ -190,9 +189,10 @@ def __and__(self: array, other: Union[int, bool, array], /) -> array:
190189
out: array
191190
an array containing the element-wise results. The returned array must have a data type determined by :ref:`type-promotion`.
192191
192+
Notes
193+
-----
193194
194-
.. note::
195-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_and`.
195+
- Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_and`.
196196
"""
197197

198198
def __array_namespace__(

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,17 @@ def acosh(x: array, /) -> array:
272272
"""
273273

274274

275-
def add(x1: Union[array, int, float], x2: Union[array, int, float], /) -> array:
275+
def add(
276+
x1: Union[array, int, float, complex], x2: Union[array, int, float, complex], /
277+
) -> array:
276278
"""
277279
Calculates the sum for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``.
278280
279281
Parameters
280282
----------
281-
x1: Union[array, int, float]
283+
x1: Union[array, int, float, complex]
282284
first input array. Should have a numeric data type.
283-
x2: Union[array, int, float]
285+
x2: Union[array, int, float, complex]
284286
second input array. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a numeric data type.
285287
286288
Returns

0 commit comments

Comments
 (0)