matrix inverse caching functions