cachematrix.R functional