Calculation of inverse

Calculation and cache of inverse matrix