cachematrix impl.