Added matrix inverse caching solution