implement cache matrix
implement cache matrix