0 votes
asked by (310 points)

I am making the transition to v3 and have come across something I don't understand. After applying an MPO to an MPS using applyMPO, I try to add the new MPS to another, unmodified MPS. My code fails at the plusEq operation on these two MPS, with the following message.

L = ITensor ord=2: (3|id=780|n=1,Site)' (2|id=376|l=1,Link)'1254313 
{norm=0.00 (Dense Real)}

R = ITensor ord=2: (3|id=780|n=1,Site) (2|id=376|l=1,Link)'1254313 
{norm=1.00 (Dense Real)}

From line 1006, file itensor.cc

ITensoITensor::operator+=: different index structure

ITensoITensor::operator+=: different index structure

I see the problem in the output -- there's a prime on the L tensor that doesn't match the same site on the R tensor. But I don't understand why it should be there, since I haven't primed anything in my code. Any help appreciated!

1 Answer

+1 vote
answered by (14.1k points)
selected by
Best answer


The short answer is that in V3, you should unprime the output MPS in order to make it have unprimed site indices:

auto Hpsi = applyMPO(H,psi);

This was a change made to the applyMPO function in V3. In V2, applyMPO automatically unprimed the output MPS. However, this was making an assumption that the MPO had indices of the form (s1,s1',s2,s2',...). This is however not always the case, for example in other tensor network algorithms where the indices on either side of the MPO are completely different (but the algorithm for applying an MPO to an MPS works essentially the same). Basically, it was a tradeoff between making the algorithm much more general but a bit more inconvenient for certain use cases.


Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.