Dear ITensor,
I posted a question about this previously, but I thought I would create a new one since it was some time ago and I've made some progress. Please let me know if it would be better to just extend the original question.
I'm trying to calculate the fidelity per unit cell of an iMPS using a transfer matrix. From what I understand, the result of your idmrg code should be multiplied by psi(0) (at psi(1)) to give the orthogonalised wavefunction. I've implemented a class to use with arnoldi, which has the product function shown below. I've been testing it with a simple transverse Ising model. The MPSs psi1 and psi2 are stored in the class, which modifies them to have matching site indices and primes the links of psi2.
void TMatrix::product(ITensor &other, ITensor &result) {
result = ITensor(other);
result = result * dag(psi1(0));
result = result * psi2(0);
for (int i = 1; i <= length(psi1); i++) {
result = result * dag(psi1(i));
result = result * psi2(i);
}
// "Fix" the indices (probably a bad idea). This runs with QNs but gets the wrong result.
//result = result.dag();
//result = result.conj();
// This gets nearly the correct result (using the PseudoInvert function from idmrg.h)
//auto z1 = psi1(0);
//auto z2 = dag(psi2(0));
//z1.apply(PseudoInvert(0));
//z2.apply(PseudoInvert(0));
//result *= z1;
//result *= z2;
}
However, this results in runtime errors with QN conservation enabled, as psi1(0) has both indices pointing "out" (as expected since it's the centre of an svd), which results in the leftmost link being flipped. It still doesn't get correct results with QNs disabled.
I tried a couple of things (commented out above): the first is to "fix" the link index so the multiplication works. However this produces incorrect results, out by a factor of 1/2. The other idea was to apply the inverse of psi(0) at the end of the product function, which results in an acceptable contraction of the indices and produces something very close to the correct result. I don't understand why this is the case, however.
I've studied various other questions here as well as the code in idmrg.h (which I understand only partially), but I don't seem to be able to get any further. Do you have any suggestions?
Thank you as always for your work on ITensor