Implementation of special matrix caching it inverse