completed cachematrix.r