implemented the caching mechanism for lenghty matrix operations such as inverse