my code for cache matrix inversion