Implement cache of inverse matrix

Implement cache of inverse matrix