editted cachematrix.R