Programming Assignment 2 Matrix Cache function