a revised version of cachematrix.R