added required functions to cachematrix.R