nlcpy.argmin
- nlcpy.argmin(a, axis=None, out=None)
Returns the indices of the minimum values along an axis.
- Parameters
- aarray_like
Input array.
- axisint, optional
By default, the index is into the flattened array, otherwise along the specified axis.
- outndarray, optional
If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
- Returns
- index_arrayndarray of ints
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
参考
注釈
In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned.
Examples
>>> import nlcpy as vp >>> a = vp.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> vp.argmin(a) array(0) >>> vp.argmin(a, axis=0) array([0, 0, 0]) >>> vp.argmin(a, axis=1) array([0, 0])
>>> b = vp.arange(6) + 10 >>> b[4] = 10 >>> b array([10, 11, 12, 13, 10, 15]) >>> vp.argmin(b) # Only the first occurrence is returned. array(0)