Learn R Programming

sparsevctrs (version 0.3.3)

sparse_sqrt: Calculate sqrt of sparse vectors

Description

Calculate sqrt of sparse vectors

Usage

sparse_sqrt(x)

Value

A sparse double vector.

Arguments

x

A sparse numeric vector.

Details

This function, as with any of the other helper functions assumes that the input x is a sparse numeric vector. This is done for performance reasons, and it is thus the users responsibility to perform input checking.

The output will be a double vector regardless of the input type.

Examples

Run this code
sparse_sqrt(
  sparse_double(1000, 1, 10)
)

sparse_sqrt(
  sparse_integer(1000, 3, 10, default = 2)
)

sparse_sqrt(
  sparse_double(c(10, NA, 11), c(1, 5, 10), 10)
)

Run the code above in your browser using DataLab