revised the original cachematrix.R