implemented functions for cached matrices