dpnp.min

dpnp.min(a, axis=None, out=None, keepdims=False, initial=None, where=True)[source]

Return the minimum of an array or maximum along an axis.

For full documentation refer to numpy.min.

Parameters:
  • a ({dpnp.ndarray, usm_ndarray}) -- Input array.

  • axis ({None, int or tuple of ints}, optional) -- Axis or axes along which to operate. By default, flattened input is used. If this is a tuple of integers, the minimum is selected over multiple axes, instead of a single axis or all the axes as before. Default: None.

  • out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. Default: None.

  • keepdims ({None, bool}, optional) -- If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. Default: False.

Returns:

out -- Minimum of a. If axis is None, the result is a zero-dimensional array. If axis is an integer, the result is an array of dimension a.ndim - 1. If axis is a tuple, the result is an array of dimension a.ndim - len(axis).

Return type:

dpnp.ndarray

Limitations

Parameters where, and initial are only supported with their default values. Otherwise NotImplementedError exception will be raised.

See also

dpnp.max

Return the maximum of an array.

dpnp.minimum

Element-wise minimum of two arrays, propagates NaNs.

dpnp.fmin

Element-wise minimum of two arrays, ignores NaNs.

dpnp.amin

The minimum value of an array along a given axis, propagates NaNs.

dpnp.nanmin

The minimum value of an array along a given axis, ignores NaNs.

Examples

>>> import dpnp as np
>>> a = np.arange(4).reshape((2,2))
>>> a
array([[0, 1],
       [2, 3]])
>>> np.min(a)
array(0)
>>> np.min(a, axis=0)   # Minima along the first axis
array([0, 1])
>>> np.min(a, axis=1)   # Minima along the second axis
array([0, 2])
>>> b = np.arange(5, dtype=float)
>>> b[2] = np.nan
>>> np.min(b)
array(nan)