Implement matrix inverse caching functions