added matrix inversion cache functions