Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions spec/draft/API_specification/elementwise_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Objects in API
logical_not
logical_or
logical_xor
maximum
minimum
multiply
negative
not_equal
Expand Down
62 changes: 62 additions & 0 deletions src/array_api_stubs/_draft/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"logical_not",
"logical_or",
"logical_xor",
"maximum",
"minimum",
"multiply",
"negative",
"not_equal",
Expand Down Expand Up @@ -1819,6 +1821,66 @@ def logical_xor(x1: array, x2: array, /) -> array:
"""


def maximum(x1: array, x2: array, /) -> array:
r"""
Computes the maximum value for each element ``x1_i`` of the input array ``x1`` relative to the respective element ``x2_i`` of the input array ``x2``.

.. note::
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).

Parameters
----------
x1: array
first input array. Should have a real-valued data type.
x2: array
second input array. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a real-valued data type.

Returns
-------
out: array
an array containing the element-wise maximum values. The returned array must have a data type determined by :ref:`type-promotion`.

Notes
-----

**Special Cases**

For floating-point operands,

- If either ``x1_i`` or ``x2_i`` is ``NaN``, the result is ``NaN``.
"""


def minimum(x1: array, x2: array, /) -> array:
r"""
Computes the minimum value for each element ``x1_i`` of the input array ``x1`` relative to the respective element ``x2_i`` of the input array ``x2``.

.. note::
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).

Parameters
----------
x1: array
first input array. Should have a real-valued data type.
x2: array
second input array. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a real-valued data type.

Returns
-------
out: array
an array containing the element-wise minimum values. The returned array must have a data type determined by :ref:`type-promotion`.

Notes
-----

**Special Cases**

For floating-point operands,

- If either ``x1_i`` or ``x2_i`` is ``NaN``, the result is ``NaN``.
"""


def multiply(x1: array, x2: array, /) -> array:
r"""
Calculates the product for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``.
Expand Down