cachematrix.R final