Element-wise greater than comparison. You can also use the > operator.
Arguments
- lhs, rhs
(
arrayish)
Two inputs with a common data type. Can be any data type. Scalars are broadcast, and R values assume the other operand's data type within their data type category, otherwise falling back to their default data type and being converted to the common data type.
Value
(arrayish)
Has the inputs' broadcast shape and boolean data type.
See also
prim_gt() for the underlying primitive.
Examples
x <- nv_array(c(1, 2, 3))
y <- nv_array(c(3, 2, 1))
nv_gt(x, y)
#> AnvlArray
#> 0
#> 0
#> 1
#> [ CPUbool{3} ]
x > y
#> AnvlArray
#> 0
#> 0
#> 1
#> [ CPUbool{3} ]
# different data types are promoted to their common one
nv_gt(nv_scalar(2, "f32"), nv_scalar(1, "f64"))
#> AnvlArray
#> 1
#> [ CPUbool{} ]
# a scalar is broadcast and an R integer is converted to a float
x > 2L
#> AnvlArray
#> 0
#> 0
#> 1
#> [ CPUbool{3} ]