Last data update: 2014.03.03
|
R: Matrix Square Root
Matrix Square Root
Description
This function computes the matrix square root of a square matrix.
The sqrt of a matrix A is S such that A = S S.
Usage
sqrtm(x)
Arguments
Details
The matrix square root S of M, S = sqrtm(M) is
defined as one (the “principal”) S such that
S S = S^2 = M, (in R, all.equal( S %*% S , M ) ).
The method works from the Schur decomposition.
Value
A matrix ‘as x ’ with the matrix sqrt of x .
Author(s)
Michael Stadelmann wrote the first version.
References
Higham, N.~J. (2008).
Functions of Matrices: Theory and Computation;
Society for Industrial and Applied Mathematics, Philadelphia, PA, USA.
See Also
expm , logm
Examples
m <- diag(2)
sqrtm(m) == m # TRUE
(m <- rbind(cbind(1, diag(1:3)),2))
sm <- sqrtm(m)
sm
zapsmall(sm %*% sm) # Zap entries ~= 2e-16
stopifnot(all.equal(m, sm %*% sm))
Results
|