inner function with different site indices

Hi ITensor,
I have difficulty with the use of the inner function. In the case of no quantum numbers, I have two different MPS and I want them to compute their inner product like they have the same site indices.

This seems to be related to the substitution of indices, but I’m not skilled enough to do this. Can you provide a minimal example?

Thank you for your kindness.

Good question – we don’t have a place in the docs where we explicitly explain this.

Say you have two MPS psi1 and psi2, then you can do the following:

s1 = siteinds(psi1)
s2 = siteinds(psi2)
for j=1:length(psi1)
  replaceind!(psi1[j],s1[j],s2[j])
end

Afterwards, psi1 will have the same site indices as psi21. You can print out the MPS to check this, or try taking inner(psi1,psi2) and it should now work.

This method is very effective, thank you very much for your help,

1 Like