Hi Alvarez

If you define

quad.form.inv <-  function (M, x)
{
     drop(crossprod(x, solve(M, x)))
}

then you will avoid an expensive call to %*% as well.


HTH


Robin

On 3 Nov 2005, at 13:01, Alvarez Pedro wrote:

> 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?
>
> Thanks a lot for help!
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting- 
> guide.html
>

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
[email protected] 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