Skip to contents

Negates an array element-wise. You can also use the unary - operator.

Usage

nv_negate(x)

Arguments

x

(arrayish)
Input array.

Value

arrayish
Has the same shape and data type as the input.

See also

prim_negate() for the underlying primitive.

Examples

x <- nv_array(c(1, -2, 3))
-x
#> AnvlArray
#>  -1
#>   2
#>  -3
#> [ CPUf32{3} ]