crafted cachematrix.R for submission