added functions to cachematrix.R