Skip to contents

Negates an array element-wise.

Usage

prim_negate(operand)

Arguments

operand

(arrayish)
Arrayish value of data type integer or floating-point.

Value

arrayish
Has the same shape and data type as the input. It is ambiguous if the input is ambiguous.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to stablehlo::hlo_negate().

See also

nv_negate(), unary -

Examples

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