Skip to contents

Computes the symmetric square root of a positive semidefinite matrix

Usage

mhalf(M)

Arguments

M

a positive semidefinite matrix

Value

a matrix H such that H^2 equals M

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples

M <- matrix(c(4, 1, 1, 4), 2, 2)
H <- mhalf(M)
H %*% H  # recovers M
#>      [,1] [,2]
#> [1,]    4    1
#> [2,]    1    4