[R] Matrix multiplication precision
Nair, Murlidharan T
mnair at iusb.edu
Wed Jul 15 03:42:34 CEST 2009
Hi!!
I am trying to multiply 5 matrices and then using the inverse of that matrix for further computation. I read about precision problems from the archives and the suggestion was to use as.numeric while computing the products. I am still having problems with the results. Here is how I am using it
#Mn.mat<-(T.mat %*% Rz.mat %*% Q.mat %*% Rz.mat %*% T.mat) # I was doing this in one step which I have broken down into multiple steps as below.
Mn1.mat<-matrix(as.numeric(T.mat %*% Rz.mat),nrow=4)
Mn2.mat<-matrix(as.numeric(Mn1.mat %*% Q.mat),nrow=4)
Mn3.mat<-matrix(as.numeric(Mn2.mat %*% Rz.mat),nrow=4)
Mn.mat<-matrix(as.numeric( Mn3.mat %*% T.mat),nrow=4)
For getting the inverse I am doing the following
Mn.mat.inv<-qr.solve(Mn.mat)
Will I run into precision problems when I do the above?
Thanks ../Murli
More information about the R-help
mailing list