matrix inversion cache