implements the methodes of cachematrix.R