Implementing cachematrix.R