Implementation of cached matrix inverse operation