My implementation of cached matrix inverse