Mass and stiffness matrices in finite element codes are typically
assembled from a large number of smaller element matrix contributions.
The naive approach to such matrix assembly in MATLAB is hideously slow.
There are alternative approaches that work better.
was at the time of writing the fastest way that I could figure out
how to put together these matrices (based on a C++ extension).