implemented functions in cachematrix.R