implemented a cacheable matrix object.