dpnp.minimum
- dpnp.minimum(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Compares two input arrays x1 and x2 and returns a new array containing the element-wise minima.
If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
For full documentation refer to
numpy.minimum
.- Parameters:
x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- First input array, expected to have numeric data type. Both inputs x1 and x2 can not be scalars at the same time.
x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array, also expected to have numeric data type. Both inputs x1 and x2 can not be scalars at the same time.
out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default:
None
.order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is
None
. Default:"K"
.
- Returns:
out -- An array containing the element-wise minima. The data type of the returned array is determined by the Type Promotion Rules.
- Return type:
dpnp.ndarray
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedError
exception will be raised.See also
dpnp.maximum
Element-wise maximum of two arrays, propagates NaNs.
dpnp.fmin
Element-wise minimum of two arrays, ignores NaNs.
dpnp.min
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.
dpnp.fmax
Element-wise maximum of two arrays, ignores NaNs.
dpnp.max
The maximum value of an array along a given axis, propagates NaNs.
dpnp.nanmax
The maximum value of an array along a given axis, ignores NaNs.
Examples
>>> import dpnp as np >>> x1 = np.array([2, 3, 4]) >>> x2 = np.array([1, 5, 2]) >>> np.minimum(x1, x2) array([1, 3, 2])
>>> x1 = np.eye(2) >>> x2 = np.array([0.5, 2]) >>> np.minimum(x1, x2) # broadcasting array([[0.5, 0. ], [0. , 1. ]]
>>> x1 = np.array([np.nan, 0, np.nan]) >>> x2 = np.array([0, np.nan, np.nan]) >>> np.minimum(x1, x2) array([nan, nan, nan])
>>> np.minimum(np.array(-np.inf), 1) array(-inf)