created cachematrix.r implementation