cachematrix edited for assignment 2