Inverse matrix calculation functions including cache