Added implementation of cacheable matrix