Unit tested version of cacheMatrix.