created functions for cachematrix.R