Implemented cacheable matrix functions.