summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_searching_functions.py
blob: 4eed66c48107d1e2cae267c0cf73fcd99e60ea6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np

def argmax(x, /, *, axis=None, keepdims=False):
    """
    Array API compatible wrapper for :py:func:`np.argmax <numpy.argmax>`.

    See its docstring for more information.
    """
    return np.argmax(x, axis=axis, keepdims=keepdims)

def argmin(x, /, *, axis=None, keepdims=False):
    """
    Array API compatible wrapper for :py:func:`np.argmin <numpy.argmin>`.

    See its docstring for more information.
    """
    return np.argmin(x, axis=axis, keepdims=keepdims)

def nonzero(x, /):
    """
    Array API compatible wrapper for :py:func:`np.nonzero <numpy.nonzero>`.

    See its docstring for more information.
    """
    return np.nonzero(x)

def where(condition, x1, x2, /):
    """
    Array API compatible wrapper for :py:func:`np.where <numpy.where>`.

    See its docstring for more information.
    """
    return np.where(condition, x1, x2)