Implement functions for caching the matrix inverse