Implemented inverse matrix caching