cachematrix with code