first version of cachematrix.R