cachematrix function complete