code for cachematrix.R