add cachematrix implementation