cachematrix function completed