smpower | R Documentation |
Raise symmetric matrix to specified power. Default calculates symmetric square root.
smpower(X, power = 0.5, tol = NULL)
X |
Symmetric real-valued matrix. |
power |
Power to apply to eigenvalues of |
tol |
Stability tolerance for eigenvalues. |
Basically returns tcrossprod(Y$vec%*%diag(Y$val^power),Y$vec)
where Y = eigen(X,symmetric=TRUE)
.
Returns X
raised to specified power.
Default tolerance is tol = max(dim(X)) * .Machine$double.eps
.
Nathaniel E. Helwig <helwig@umn.edu>
########## EXAMPLE ##########
X <- crossprod(matrix(rnorm(2000),100,20))
Xsqrt <- smpower(X) # square root
Xinv <- smpower(X,-1) # inverse
Xisqrt <- smpower(X,-0.5) # inverse square root
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.