Matrix with cached inverse