That awkward moment, when the code written in matlab is easier to read and understand then tons os explanations:
Salakhudinov’s code of RBM
This code IMHO is a good argument when you need to explain someone that he really needs to learn at least one language with vectorization, no matter whether it is R, matlab, or numpy or theano in python.
I also shall note, that vectorization is not `solution to everything`. For example, you can see Friedman's highly optimized fortran code of GLM (Generalized linear models)
Disclaimer: you'll be unable to unsee this.