Add functions to cache matrix inversion results