Completion of cachematrix.R file