Cache matrix inversion