implemented cachematrix methods