Implementation of cached matrix inverse functionality