Final version of cachematrix.R