implement cache solve and cachematrix