Cachematrix functions