Functions to obtain inverse value matrix and caching