How to compute the power of a matrix in R
matrix, r
Solution
After some time, the following solution came up:
"%^%" <- function(S, power)
with(eigen(S), vectors %*% (values^power * t(vectors)))
S%^%(-0.5)
The result gives the expected answer:
[,1] [,2]
[1,] 3.36830328 -0.02004191
[2,] -0.02004191 3.43755430
Problem
I'm trying to compute the -0.5 power of the following matrix: ``` S <- matrix(c(0.088150041, 0.001017491 , 0.001017491, 0.084634294),nrow=2) ``` In Matlab, the result is (`S^(-0.5)`): ``` S^(-0.5) ans = 3.3683 -0.0200 -0.0200 3.4376 ```