Update cachematrix.R

Analogously to vector.