edited cachematrix.r