Caching the inverse of a matrix