cache matrix inversion