Expecatation value of a string of operator

Hi everyone,
I am trying to compute the expectation value of strings of operators, something like :

C_z=\langle\sigma^1_z\otimes\sigma^2_z\otimes\sigma^3_z\otimes\sigma^4_z\otimes\sigma^5_z\otimes\sigma^6_z\rangle

where each operator acts on a different site. I am doing this like:

        auto c_z = AutoMPO(sites); 
        c_z += "Sz",1,"Sz",2,"Sz",3,"Sz",4,"Sz",5,"Sz",6;    
        auto C_z= toMPO(c_z);
        auto b=inner(psi0,C_z,psi0);

where \psi_0 is an MPS computed before. I am pretty sure this is not the most efficient way to do it,but I couldn’t figure out another method that wouldn’t cause any error. Any suggestion or help?
Thank you a lot for your help,
Francesco

1 Like

Hi Franceco,
Probably the most efficient way to do this kind of measurement is to make a copy of your MPS, then apply the string of operators to it one at a time, following this “code formula”
http://itensor.org/docs.cgi?vers=cppv3&page=formulas/mps_onesite_op

Then you can use inner to compute the overlap with your original MPS and that will compute the result.

If you have multiple strings of operators then there might be other considerations for efficiency, but this would definitely be a good and efficient approach for a single string.

(The most efficient approach would be to basically write you own version of how the inner algorithm works, but then “stick in” operators on the sites where there are non-trivial operators, roughly like the code in this code formula but adapted to a whole string of operators.)