Friday, June 20, 2014


Pirates code in arrrrrrr (R).

I'm really excited to be attending DC2's workshop tomorrow, High-performance Computing in R. I'll post a recap here after the class.

I've gotten quite good at R coding over the last couple years. I've posted before that those who would complain about R's speed are likely not putting enough thought into their coding. R is a vectorized language. So, study your matrix algebra, people! (Also, note that R is an interpreted language; it can only go so fast even at its best.)

There are, however, some things that you can't vectorize. Gibbs sampling, for example, is index dependent. For example, your sample at iteration j + 1 is dependent on the result of your sample at iteration j. For this, C, C++, and Fortran play nicely with R.

There's also the issue of parallelization. I use the snowfall package regularly with great success. I am lately interested in playing with CUDA-enabled GPUs to get more cores. Not sure if this'll be covered in the course, but we'll see.


  1. i'm impressed. you didn't leave me much room to bash R in the HPC space... but if you ask me hpc computing in R is a misnomer. :)

    just want to add it might be possible to vectorize some non-obvious things..but being non-obvious it would just be easier and clearer to write for loops for them. some thing that seems to me pretty much impossible to vectorize is recursion with the canonical example being finding factorials (obligatory wikipedia ref )

  2. Agree on the HPC, actually. When I hear "high-performance computing", I'm thinking of something completely different. Though, as an addendum to this post, there is this:


Note: Only a member of this blog may post a comment.