Implemented matrix cache functions