Implementation of caching system for matrix inversion. Implemented simple test function for this mechanism.