add lsmatrix and echain