cachematrix.R implemented