Cached matrix inverse