cachematrix.R first attempt