Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/array_api_stubs/_2022_12/array_object.py
Original file line number Diff line number Diff line change
@@ -146,15 +146,15 @@ def __abs__(self: array, /) -> array:
Added complex data type support.
"""

def __add__(self: array, other: Union[int, float, array], /) -> array:
def __add__(self: array, other: Union[int, float, complex, array], /) -> array:
"""
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance (augend array). Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
addend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -374,15 +374,15 @@ def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
ROCM = 10
"""

def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
def __eq__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
r"""
Computes the truth value of ``self_i == other_i`` for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance. May have any data type.
other: Union[int, float, bool, array]
other: Union[int, float, complex, bool, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
Returns
@@ -393,6 +393,9 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
.. note::
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
.. versionchanged:: 2022.12
Added complex data type support.
"""

def __float__(self: array, /) -> float:
@@ -746,7 +749,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
"""

def __mul__(self: array, other: Union[int, float, array], /) -> array:
def __mul__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Calculates the product for each element of an array instance with the respective element of the array ``other``.
@@ -757,7 +760,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -775,15 +778,15 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
Added complex data type support.
"""

def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
def __ne__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
"""
Computes the truth value of ``self_i != other_i`` for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance. May have any data type.
other: Union[int, float, bool, array]
other: Union[int, float, complex, bool, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
Returns
@@ -852,9 +855,6 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array:
.. note::
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_or`.
.. versionchanged:: 2022.12
Added complex data type support.
"""

def __pos__(self: array, /) -> array:
@@ -876,7 +876,7 @@ def __pos__(self: array, /) -> array:
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
"""

def __pow__(self: array, other: Union[int, float, array], /) -> array:
def __pow__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
@@ -889,7 +889,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -933,7 +933,7 @@ def __setitem__(
key: Union[
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array
],
value: Union[int, float, bool, array],
value: Union[int, float, complex, bool, array],
/,
) -> None:
"""
@@ -947,7 +947,7 @@ def __setitem__(
array instance.
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array]
index key.
value: Union[int, float, bool, array]
value: Union[int, float, complex, bool, array]
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
@@ -960,7 +960,7 @@ def __setitem__(
When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
"""

def __sub__(self: array, other: Union[int, float, array], /) -> array:
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:
"""
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
@@ -970,7 +970,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance (minuend array). Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -988,7 +988,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
Added complex data type support.
"""

def __truediv__(self: array, other: Union[int, float, array], /) -> array:
def __truediv__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Evaluates ``self_i / other_i`` for each element of an array instance with the respective element of the array ``other``.
@@ -1001,7 +1001,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
35 changes: 19 additions & 16 deletions src/array_api_stubs/_2023_12/array_object.py
Original file line number Diff line number Diff line change
@@ -148,15 +148,15 @@ def __abs__(self: array, /) -> array:
Added complex data type support.
"""

def __add__(self: array, other: Union[int, float, array], /) -> array:
def __add__(self: array, other: Union[int, float, complex, array], /) -> array:
"""
Calculates the sum for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance (augend array). Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
addend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -494,15 +494,15 @@ def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
ONE_API = 14
"""

def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
def __eq__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
r"""
Computes the truth value of ``self_i == other_i`` for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance. May have any data type.
other: Union[int, float, bool, array]
other: Union[int, float, complex, bool, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
Returns
@@ -513,6 +513,9 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
.. note::
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
.. versionchanged:: 2022.12
Added complex data type support.
"""

def __float__(self: array, /) -> float:
@@ -893,7 +896,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
"""

def __mul__(self: array, other: Union[int, float, array], /) -> array:
def __mul__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Calculates the product for each element of an array instance with the respective element of the array ``other``.
@@ -904,7 +907,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -922,15 +925,15 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
Added complex data type support.
"""

def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
def __ne__(self: array, other: Union[int, float, complex, bool, array], /) -> array:
"""
Computes the truth value of ``self_i != other_i`` for each element of an array instance with the respective element of the array ``other``.
Parameters
----------
self: array
array instance. May have any data type.
other: Union[int, float, bool, array]
other: Union[int, float, complex, bool, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). May have any data type.
Returns
@@ -1024,7 +1027,7 @@ def __pos__(self: array, /) -> array:
Added complex data type support.
"""

def __pow__(self: array, other: Union[int, float, array], /) -> array:
def __pow__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
@@ -1037,7 +1040,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -1081,7 +1084,7 @@ def __setitem__(
key: Union[
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array
],
value: Union[int, float, bool, array],
value: Union[int, float, complex, bool, array],
/,
) -> None:
"""
@@ -1095,7 +1098,7 @@ def __setitem__(
array instance.
key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array]
index key.
value: Union[int, float, bool, array]
value: Union[int, float, complex, bool, array]
value(s) to set. Must be compatible with ``self[key]`` (see :ref:`broadcasting`).
@@ -1108,7 +1111,7 @@ def __setitem__(
When ``value`` is an ``array`` of a different data type than ``self``, how values are cast to the data type of ``self`` is implementation defined.
"""

def __sub__(self: array, other: Union[int, float, array], /) -> array:
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:
"""
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
@@ -1118,7 +1121,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance (minuend array). Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
@@ -1136,7 +1139,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
Added complex data type support.
"""

def __truediv__(self: array, other: Union[int, float, array], /) -> array:
def __truediv__(self: array, other: Union[int, float, complex, array], /) -> array:
r"""
Evaluates ``self_i / other_i`` for each element of an array instance with the respective element of the array ``other``.
@@ -1149,7 +1152,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
----------
self: array
array instance. Should have a numeric data type.
other: Union[int, float, array]
other: Union[int, float, complex, array]
other array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Returns
3 changes: 3 additions & 0 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
@@ -515,6 +515,9 @@ def __eq__(self: array, other: Union[int, float, complex, bool, array], /) -> ar
- Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
- Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
.. versionchanged:: 2022.12
Added complex data type support.
"""

def __float__(self: array, /) -> float: