In an attempt to calculate the power of matrix in R, I found that the package expm Applies.
Then calculates the power of X% ^% K matrix K
& gt; A & LT; -Matrix (c (1,3,0,2,8,4,1,1,1), nero = 3) & gt; A% ^% 5 [, 1] [, 2] [, 3] [1,] 6469 18038 2929 [2,] 21837 60 9 02 9889 [3,] 10440 29116 4729 But, to my surprise:
& gt; A [, 1] [, 2] [, 3] [1,] 691 1932 312 [2,] 2331 6502 1056 [3,] 1116 3108 505 From the initial matrix A. How do you do the matrix power operation
I have the R-Forge Sources ("XM" package) K) has fixed that bug, svn rev 53. - For some reasons the web page still shows Rev.52, so the following has not solved your problem yet (but should be within 24 hours):
install.packages ("expm", Repos = "http://r-forge.r-project.org") < / Code> Otherwise, get the right svn version, and install yourself:
svn checkout svn: //svn.r-forge.r-project .org / svnroot / expm Thanks for "gd047" Note that R-Forge has its own bug tracking feature.
Martinect
Comments
Post a Comment