Matrix with cached inverse implementation