nlcpy.amin
- nlcpy.amin(a, axis=None, out=None, keepdims=<no value>, initial=<no value>, where=<no value>)[source]
Returns the minimum of an array or minimum along an axis.
- Parameters
- aarray_like
Array containing numbers whose minimum is desired. If a is not an array, a conversion is attempted.
- axisNone or 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 ints, the minimum is selected over multiple axes.
- outndarray, optional
Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.
- keepdimsbool, 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.
- initialscalar, optional
The maximum value of an output element. Must be present to allow computation on empty slice. See
nlcpy.ufunc.reduce()
for details.- wherearray_like of bool, optional
Elements to compare for the minimum. See
nlcpy.ufunc.reduce()
for details.
- Returns
- aminndarray
Minimum of a. An array with the same shape as a, with the specified axis removed. If a is a scalar, or if axis is None, this function returns the result as a 0-dimention array. The same dtype as a is returned.
See also
amax
Returns the maximum of an array or maximum along an axis.
nanmin
Returns minimum of an array or minimum along an axis, ignoring any NaNs.
minimum
Element-wise minimum of array elements.
fmin
Element-wise minimum of array elements.
argmin
Returns the indices of the minimum values along an axis.
nanmax
Returns the maximum of an array or maximum along an axis, ignoring any NaNs.
maximum
Element-wise maximum of array elements.
fmax
Element-wise maximum of array elements.
Note
NaN values are propagated, that is if at least one item is NaN, the corresponding min value will be NaN as well. To ignore NaN values, please use nanmin.
Don’t use
amin()
for element-wise comparison of 2 arrays; whena.shape[0]
is 2,minimum(a[0], a[1])
is faster thanamin(a, axis=0)
.Restriction
If an ndarray is passed to
where
andwhere.shape != a.shape
, NotImplementedError occurs.If an ndarray is passed to
out
andout.shape != amin.shape
, NotImplementedError occurs.
Examples
>>> import nlcpy as vp >>> a = vp.arange(4).reshape((2,2)) >>> a array([[0, 1], [2, 3]]) >>> vp.amin(a) # Minimum of the flattened array array(0) >>> vp.amin(a, axis=0) # Minima along the first axis array([0, 1]) >>> vp.amin(a, axis=1) # Minima along the second axis array([0, 2]) >>> b = vp.arange(5, dtype=float) >>> b[2] = vp.NaN >>> vp.amin(b) array(nan) >>> vp.amin(b, where=~vp.isnan(b), initial=10) array(0.) >>> vp.nanmin(b) array(0.)