submission of cachematrix.R edit for Hunter Allman