cachematrix.R with comments