Finds the minimum of array elements along the specified axes.
Arguments
- x
(
arrayish)
Input array.- axes
(
integer()|NULL)
Axes to reduce. Negative values count from the end, i.e.-1refers to the last axis. IfNULL(default), reduces over all axes, returning a scalar.- drop
(
logical(1))
Whether to drop reduced axes.- nan_rm
(
logical(1))
How to handleNaNvalues in floating-point inputs. IfFALSE(default),NaNpropagates. IfTRUE,NaNvalues are skipped.
Value
arrayish
Has the same data type as the input.
When drop = TRUE, the reduced axes are removed.
When drop = FALSE, the reduced axes are set to 1.
See also
prim_reduce_min() for the underlying primitive.
Examples
x <- nv_matrix(1:6, nrow = 2)
nv_reduce_min(x) # all axes -> scalar
#> AnvlArray
#> 1
#> [ CPUi32{} ]
nv_reduce_min(x, axes = 1L)
#> AnvlArray
#> 1
#> 3
#> 5
#> [ CPUi32{3} ]
nv_reduce_min(nv_array(c(1, NaN, 3)))
#> AnvlArray
#> nan
#> [ CPUf32{} ]
nv_reduce_min(nv_array(c(1, NaN, 3)), nan_rm = TRUE)
#> AnvlArray
#> 1
#> [ CPUf32{} ]