Implementing cache invers matrix