The matrix mat
must be symmetric and positive semi-definite. Otherwise, there is an error.
The square root of the matrix mat
is the positive semi-definite matrix M
such as t(M) %*% M = mat
.
Do not confuse with sqrt(mat)
, which returns the square root of the elements of mat
.
The computation is based on the diagonalisation of mat
. The eigenvalues smaller than 10^-16 are identified as null values.