caching inverted matrix for repeated use