Implementation of caching the inverse matrix once computed.