Performs logical OR along the specified axes.
Returns TRUE if any element is TRUE.
Usage
nv_reduce_any(x, axes = NULL, drop = TRUE)
Arguments
- x
(arrayish)
Input array.
- axes
(integer() | NULL)
Axes to reduce. Negative values count from the end, i.e. -1
refers to the last axis. If NULL (default), reduces over all
axes, returning a scalar.
- drop
(logical(1))
Whether to drop reduced axes.
Value
arrayish
Boolean array.
When drop = TRUE, the reduced axes are removed.
When drop = FALSE, the reduced axes are set to 1.
Examples
x <- nv_matrix(c(TRUE, FALSE, TRUE, TRUE), nrow = 2)
nv_reduce_any(x) # all axes -> scalar
#> AnvlArray
#> 1
#> [ CPUbool{} ]
nv_reduce_any(x, axes = 1L)
#> AnvlArray
#> 1
#> 1
#> [ CPUbool{2} ]