From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>

Date: Fri 27 Jan 2006 - 02:57:21 EST

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 Received on Fri Jan 27 03:22:41 2006

Date: Fri 27 Jan 2006 - 02:57:21 EST

Perhaps you guys should try to benchmark that test on an nVidia GPU?

;-)

Best regards,

Marc

On Thu, 2006-01-26 at 15:55 +0100, Uwe Ligges wrote:

> Philippe Grosjean wrote:

*>
**> > Excellent, but...
**> >
**> > > x <- rnorm(1000000)
**> > > y <- rnorm(1000000)
**> > > system.time(x%*%y)
**> > [1] 0.03 0.00 0.03 NA NA
**> > > system.time(sum(x*y))
**> > [1] 0.05 0.00 0.04 NA NA
**> > > system.time(crossprod(x, y))
**> > [1] 0 0 0 NA NA
**> >
**> > So, to paraphrase a well-known contributor on this mailing list:
**> > "Excellent! So, what did you decided to do during the next 30
**> > milliseconds you will save by using crossprod() instead of x%*%y?
**> > (joke)
**> >
**> > Best,
**> >
**> > Philippe Grosjean
**> >
**> > P.S.: Uwe, perhaps you should consider buying a faster computer, isn't
**> > it? :-()
**>
**> Well, I use R, you know. It is even fast enough for my 5 year old
**> laptop. For your super computer, please replace 1e6 by 1e8 in the
**> example above. ;-)
**>
**> Uwe
**>
**>
**> > Uwe Ligges wrote:
**> >
**> >> dimitrijoe@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@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 Received on Fri Jan 27 03:22:41 2006

*
This archive was generated by hypermail 2.1.8
: Fri 27 Jan 2006 - 08:12:33 EST
*