working copy of the cachematrix.R code by Srinivas Kolluru.