...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 !!! 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.45 0.00 0.90 > > system.time({C1 = t(X) %*% X}) > user system elapsed > 0.02 0.00 0.05 > > system.time({C2 = crossprod(X)}) > user system elapsed > 0.02 0.00 0.02 > > -- > View this message in context: > http://r.789695.n4.nabble.com/Speed-up-sum-of-outer-products-tp3330160p3330378.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.