cacheMatrix for programming assignment 2