I understand how to go about measuring a two-point correlator with respect to some eigenstate of the Hamiltonian - we simply follow the prescription outlined here . However how would we go about calculating < phi|OP1OP2|psi>, for two different eigenstates |phi> and |psi>? My attempt at the code is
auto op_i = sites.op(opi,i);
auto op_j = sites.op(opj,j);
psi1.position(i);
psi2.position(i);
auto ir = commonIndex(psi1.A(i),psi1.A(i+1),Link);
auto C = psi2.A(i)*op_i*dag(prime(psi1.A(i),Site,ir));
for(int k = i+1; k < j; ++k)
{
C *= psi1.A(k);
C *= dag(prime(psi2.A(k),Link));
}
C *= psi1.A(j);
C *= op_j;
auto jl = commonIndex(psi2.A(j),psi2.A(j-1),Link);
C *= dag(prime(psi2.A(j),jl,Site));
complex<double> result = C.cplx();
return result;
Similarly to calculate an expectation value of one operator, we take
auto opi = sites.op(op_i,i);
psi.position(i);
complex<double> result = (dag(prime(psi.A(i),Site))*opi*psi.A(i)).cplx();
return result;
Whereas the matrix element generalization
auto opi = sites.op(op_i,i);
psi1.position(i);
psi2.position(i);
complex<double> result = (dag(prime(psi1.A(i),Site))*opi*psi2.A(i)).cplx();
return result;
does not work. In the case of a two point correlator, I'm told that I need to pass 4 indices to .cplx(), and in the case of the matrix element I'm missing two indices. What am I missing? Thanks!