Skip to contents

Same thing as 'expm::sqrtm', but faster.

Usage

sqrt_matrix(mat, symmetric)

Arguments

mat

Matrix to find square root matrix of

symmetric

Is it symmetric? Passed to eigen.

Value

Square root of mat

Examples

mat <- matrix(c(1,.1,.1,1), 2, 2)
smat <- sqrt_matrix(mat=mat, symmetric=TRUE)
smat %*% smat
#>      [,1] [,2]
#> [1,]  1.0  0.1
#> [2,]  0.1  1.0