cachematrix code for Programming Assignment2