assignment 2 - matrix cache