Alvarez Pedro <[EMAIL PROTECTED]> writes:

> On page 22 of the R-introduction guide it's written:
> 
> the quadratic form x^{'} A^{-1} x which is used in
> multivariate computations, should be computed by
> something like x%*%solve(A,x), rather than computing
> the inverse of A.
> 
> Why isn't it good to compute t(x) %*% solve(A) %*% x?

It's just a waste of CPU time. For k x k matrices, solution of Ax=b is
of computational complexity O(k^2) whereas inversion of A is O(k^3).
This is obviously more important for k=1000 than for k=5.

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to