Skip to contents

Element-wise reciprocal square root, i.e. 1 / sqrt(x).

Usage

nv_rsqrt(x)

Arguments

x

(arrayish)
One input. Can be any numeric data type: a float keeps its own, and an integer one is converted to the default float data type (see default_dtypes()). An R value materializes at its default data type and is converted in the same way.

Value

(arrayish)
Has the input's shape, and its data type – or the default float data type (see default_dtypes()) where the input was an integer one.

See also

prim_rsqrt() for the underlying primitive.

Examples

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

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