modified cachematrix.r