Add implementation of the cachematrix