Caching of inverse of a matrix