slightly updated cachematrix.R