Implemented cacheable matrix inverse