Add code to implement caching of inverse of matrix x