Calculate second order renyi entropy of a MPS state.

Suppose I get a MPS state psi when I finish a time evolution, I want to calculate its second renyi entropy. Refer to the tutorial code in Itensor, I write down the code like this

function calcuate_entropy(psi_e, c)
    orthogonalize!(psi_e, c)
    ## which does not modify the original tensor data
    U,S,V = svd(psi_e[c], (linkind(psi_e, c-1), siteind(psi_e,c)))
    SvN = 0.0
    for n=1:dim(S, 1)
        p = S[n,n]^2
        SvN -= log(p^2)
    end
    return SvN
end

where psi_e is the MPS state, c is partition position. I am not sure that my code can give the right answer. The second renyi entropy can be calculated by S = -\log(\text{Tr}[\rho^2]).

Thanks.

Hi, so here it’s helpful to write out each type of entropy formula as an explicit sum over the eigenvalues of \rho. Let’s call these eigenvalues p_n.

For second Renyi entropy S_2, it is:

S_2 = -\log(\text{Tr}[\rho^2]) = -\log(\sum_n p^2_n)

For von Neumann entropy S_{vN} it is:

S_{vN} = -\text{Tr}[\rho \log\rho] = -\sum_n p_n \log(p_n)

In contrast, your code is computing -\sum_n \log(p_n) which is not equal to either of these formulas. I think the fix you need is to first sum the squares of the eigenvalues of \rho, then take the log afterwards versus taking the log of each value in the sum.

Thanks. :grin: