Implementation for matrix inversion caching