Yu Chen's implementation of cachematrix