Caching matrix inversion.