cachematrix.R stub modified - implemented function as required