dpnp.fmin
- dpnp.fmin(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 the non-NaN 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 ignored when possible.
For full documentation refer to
numpy.fmin.- 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. If
x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).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 ({None, "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
NotImplementedErrorexception will be raised.See also
dpnp.fmaxElement-wise maximum of two arrays, ignores NaNs.
dpnp.minimumElement-wise minimum of two arrays, propagates NaNs.
dpnp.minThe minimum value of an array along a given axis, propagates NaNs.
dpnp.nanminThe minimum value of an array along a given axis, ignores NaNs.
dpnp.maximumElement-wise maximum of two arrays, propagates NaNs.
dpnp.maxThe maximum value of an array along a given axis, propagates NaNs.
dpnp.nanmaxThe maximum value of an array along a given axis, ignores NaNs.
Notes
fmin(x1, x2)is equivalent todpnp.where(x1 <= x2, x1, x2)when neither x1 nor x2 are NaNs, but it is faster and does proper broadcasting.Examples
>>> import dpnp as np >>> x1 = np.array([2, 3, 4]) >>> x2 = np.array([1, 5, 2]) >>> np.fmin(x1, x2) array([1, 3, 2])
>>> x1 = np.eye(2) >>> x2 = np.array([0.5, 2]) >>> np.fmin(x1, x2) array([[0.5, 0. ], [0. , 1. ]])
>>> x1 = np.array([np.nan, 0, np.nan]) >>> x2 = np.array([0, np.nan, np.nan]) >>> np.fmin(x1, x2) array([ 0., 0., nan])