Performs logical OR along the specified dimensions.
Returns TRUE if any element is TRUE.
Usage
nv_reduce_any(operand, dims = NULL, drop = TRUE)
Arguments
- operand
(arrayish)
Operand.
- dims
(integer() | NULL)
Dimensions to reduce. If NULL (default), reduces over all
dimensions, returning a scalar.
- drop
(logical(1))
Whether to drop reduced dimensions.
Value
arrayish
Boolean array.
When drop = TRUE, the reduced dimensions are removed.
When drop = FALSE, the reduced dimensions are set to 1.
Examples
x <- nv_matrix(c(TRUE, FALSE, TRUE, TRUE), nrow = 2)
nv_reduce_any(x) # all dims -> scalar
#> AnvlArray
#> 1
#> [ CPUbool{} ]
nv_reduce_any(x, dims = 1L)
#> AnvlArray
#> 1
#> 1
#> [ CPUbool{2} ]