Implementing algorithm in arxiv: 1304.6112, used in numpy opt_einsum.
Implementing algorithm in arxiv: 1304.6112, used in numpy opt_einsum.