Complete version of cachematrix.R