Full implementation of cacheMatrix.R