Implemented matrix with cached inverse