min

min(x: array, /, *, axis: int | Tuple[int, ...] | None = None, keepdims: bool = False) array

Calculates the minimum value of the input array x.

Note

When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if x is a floating-point input array, return NaN), or return the maximum possible value for the input array x data type (e.g., if x is a floating-point array, return +infinity).

Special Cases

For floating-point operands,

  • If x_i is NaN, the minimum value is NaN (i.e., NaN values propagate).

Parameters:
  • x (array) – input array. Should have a numeric data type.

  • axis (Optional[Union[int, Tuple[int, ...]]]) – axis or axes along which minimum values must be computed. By default, the minimum value must be computed over the entire array. If a tuple of integers, minimum values must be computed over multiple axes. Default: None.

  • keepdims (bool) – if True, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see Broadcasting). Otherwise, if False, the reduced axes (dimensions) must not be included in the result. Default: False.

Returns:

out (array) – if the minimum value was computed over the entire array, a zero-dimensional array containing the minimum value; otherwise, a non-zero-dimensional array containing the minimum values. The returned array must have the same data type as x.