Implemented matrix cache