R: The R matrix

From MathWiki

From Andrew Gelman, "A trick to speed up R matrix calculations"


This is another example of why defaults matter a lot.

There exists a trick to speed up R matrix caculation. He found that if we replace the default Rblas.dll in R with the proper one. It can boost R's speed in doing matrix caculation.

The link to the file and the steps to utilize it, complete with examples, is here. Speeding up the R matrix (http://www.stat.columbia.edu/~cook/movabletype/archives/2008/06/a_trick_to_spee.html)

Here are the steps to replace the Rblas.dll file (for Windows users):

1. Check what kind of processor (CPU) your PC or laptop is using (My computer --> Property). Download Rblas.dll from the corresponding directory under http://cran.r-project.org/bin/windows/contrib/ATLAS/.

2. Go to your R directory tp locate where the Rblas.dll is, for example, c:/program files/R/R.2-7.0/bin. Rename it as Rblasold.dll so that if the new Rblass.dll doesn't fit, you can use the old one by renaming it back.

3. Copy the new Rblass.dll you just download in this folder.

4. Restart R!

Overall, R with the new Rblas.dll is twice faster than R with the old one. Now we wonder why this isn't a default design for R.