UPDATED: Much improved RCM function.

Performance is now ~8% slower than equivilent MATLAB function.  Not too
bad.