Hi Stefan,
thats really interesting - I never though of trying to benchmark Linux-64
against OSX (a friend who works on large databases, says OSX performs better
than Linux in his work!). Thanks for posting your comparison, and your hints
:)
i) I guess you have a very fast CPU (Core i7 or so, I
Hi Dennis, sorry for the delayed reply and thanks for the article. I digged
into it and found that if you have a GPU, the CUBLAS library beats the
BLAS/ATLAS implementation in the Matrix package for 'large' problems. Here's
what I mean,
its = 2500
dim = 1750
X = matrix(rnorm(its*dim),its, dim)
Hi Ajay,
thanks for this comparison, which prodded me to give CUDA another try on my now
somewhat aging MacBook Pro.
Hi Dennis, sorry for the delayed reply and thanks for the article. I digged
into it and found that if you have a GPU, the CUBLAS library beats the
BLAS/ATLAS implementation in
Hi, I'm new to R and stats, and I'm trying to speed up the following sum,
for (i in 1:n){
C = C + (X[i,] %o% X[i,]) # the sum of outer products - this is very
slow
according to Rprof()
}
where X is a data matrix (nrows=1000 X ncols=50), and n=1000. The sum has to
be
What you're doing is breaking up the calculation of X'X
into n steps. I'm not sure what you mean by very slow:
X = matrix(rnorm(1000*50),1000,50)
n = 1000
system.time({C=matrix(0,50,50);for(i in 1:n)C = C + (X[i,] %o% X[i,])})
user system elapsed
0.096 0.008 0.104
Of course, you
-boun...@r-project.org] On
Behalf Of Phil Spector
Sent: Tuesday, March 01, 2011 12:31 PM
To: AjayT
Cc: r-help@r-project.org
Subject: Re: [R] Speed up sum of outer products?
What you're doing is breaking up the calculation of X'X
into n steps. I'm not sure what you mean by very slow:
X
Hey thanks alot guys !!! That really speeds things up !!! I didn't know %*%
and crossprod, could operate on matrices. I think you've saved me hours in
calculation time. Thanks again.
system.time({C=matrix(0,50,50);for(i in 1:n)C = C + (X[i,] %o% X[i,])})
user system elapsed
0.450.00
...and this is where we cue the informative article on least squares
calculations in R by Doug Bates:
http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf
HTH,
Dennis
On Tue, Mar 1, 2011 at 10:52 AM, AjayT ajaytal...@googlemail.com wrote:
Hey thanks alot guys !!! That really speeds things up
8 matches
Mail list logo