Implementation of inverse matrix solver with cache