edited MatrixChain