dimitrijoe at ipea.gov.br wrote:
> Hi,
>
> x and y are (numeric) vectors. I wonder if one of the following is more
> efficient than the other:
>
> x%*%y
>
> or
>
> sum(x*y)
> ?
I'd try
x <- rnorm(1000000)
y <- rnorm(1000000)
system.time(x%*%y)
system.time(sum(x*y))
and finally (hint, hint!):
system.time(crossprod(x, y))
Uwe Ligges
> Thanks,
> Dimitri Szerman
>
> ______________________________________________
> R-help at 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