On 3 Nov 2005, at 17:25, Robin Hankin wrote:

> 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.
>
Is %*% really expensive in all platforms? I had a function that used QR 
decomposition instead of quadratic forms, but then I got a message from 
Canada suggesting that %*% would be faster. Indeed, it was in 
not-too-large data sets and in Mac (or powerpc). I run some tests with 
real applications, and found that my 800MHz iBook G4 run like a 2.5GHz 
Intel machine when %*% was used. This really was architecture 
dependent, since the performance boost was similar under OS X and Linux 
in the very same PowerPC. So it seems that %*% is very cheap if you 
have PowerPC, but it may be expensive in Intel. (I also run a test in 
Sun, and it was somewhere between Intel and PowerPC.)

cheers, jari oksanen
--
Jari Oksanen, Oulu, Finland

______________________________________________
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