[R] Matrix inverse

gb gb at stat.umu.se
Mon May 1 15:18:15 CEST 2000


On Fri, 28 Apr 2000, Thomas Lumley wrote:

> On Fri, 28 Apr 2000, Patrik Waldmann wrote:
> 
> > I haven't found a function that directly calculates the matrix inverse, does it exist? Otherwise what would be the fastest way to do it?
> > 
> 
> Ainv<-solve(A)
> 
> Note that if you want to solve Ax=b you can do solve(A,b), which should be
> quicker than solve(A)%*%b

How about 'Ainv <- qr.solve(A)'?

I happened to read the help page for 'qr.solve' the other day, and there I
found that qr.solve(A, b) "is == but much better than solve(A) %*% b".
(I guess that 'better than' refers to numerical stability?)

Is qr.solve generally to be preferred to solve, which seems to be
indicated by the cited help page? And what is hidden behind solve?

Göran 
-- 
 Göran Broström, professor           tel: +46 90 786 5223
 Department of Statistics            fax: +46 90 786 6614
 Umeå University
 SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list