It would be good to add a page somewhere with a list of performance tips for ITensor/tensor network contraction methods.
One example is a performance issue I was just running into, where I was contracting two MPS psi and phi like this:
auto N = 10;
auto sites = SiteSet(N,2);
auto psi = MPS(sites);
auto phi = MPS(sites);
auto O = psi(1)*phi(1);
for( auto n : range1(N) )
O *= psi(n) * phi(n);
and getting really bad performance (for medium to large bond dimensions). The definition of *= in ITensor leads to a different order of operations than I was expecting (performing psi(n)*phi(n) first, then contracting with O). So a better way is to write this as:
for( auto n : range1(N) )
{
O *= psi(n);
O *= phi(n);
}
I was used to the definition of x *= y from Julia, where it is always lowered to x = x * y, so it took longer than it should have for me to catch this. Anyway, just adding a note about this for future reference.