amended cachematrix.R and added necessary comments