Skip to contents

Element-wise square root.

Usage

prim_sqrt(x)

Arguments

x

(arrayish)
One input. Can be any float data type. An R value materializes at its default data type.

Value

(arrayish)
Has the input's shape and data type.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to hlo_sqrt(), specified under sqrt.

See also

Examples

# the input's data type carries through
x <- nv_array(c(1, 4, 9))
prim_sqrt(x)
#> AnvlArray
#>  1
#>  2
#>  3
#> [ CPUf32{3} ] 

# an R value materializes at its default data type
prim_sqrt(4)
#> AnvlArray
#>  2
#> [ CPUf32{} ]