# Entanglement Entropy from density matrix

+1 vote

Hi all,

I'm trying to perform a quantum dynamics using trajectories. At each step I have N MPS corresponding each one to a given trajectory.
I need to calculate the entanglement entropy of the state as an average over quantum trajectories.
Turns out, obviously, that considering
$$|\psi> =\frac{1}{N}\sumi |\psii>$$
where @@|\psii>@@ is the i-th MPS and computing the entanglement entropy, is different than considering
$$\rho =\frac{1}{N}\sum i |\psii><\psii|$$
and computing the entanglement entropy again.

My problem is that while in the first case I can perform an SVD and get the singular values in given QN sectors, in the second case I don't know how to approach to the calculation.

In summary, I'm not sure how to proceed to calculate the entanglement entropy starting from a density matrix (Written as MPO) instead of a state (written as an MPS), in a given symmetry sector.

Best,
Vittorio

commented by (480 points)
Hi Vittorio,

Assuming you're using the C++ version (else, look for the same stuff mentioned below but here: https://itensor.github.io/ITensors.jl/stable/index.html)

For the first case, note that your psi isn't normalized when you do \sum_{i}, so you might want to normalize that (I don't think it's done automatically, but that's straight-forward for you to calculate, for the function to normalize an MPS, look at the section on the Functions for Modifying an MPS here: https://www.itensor.org/docs.cgi?vers=cppv3&page=classes/mps).

Since the density matrix is an Hermitian matrix, you can use the Tensor Decompositions for matrices rather than MPSs (http://itensor.org/docs.cgi?vers=cppv2&page=classes/decomp). I've used the diagHermitian with good success, but there is also a denmatDecomp that is worth looking at. There are examples in that page for both.

It'll save you some waiting time if you check the documentation before posting a question. For instance, looking at the In-Depth Documentation page (http://www.itensor.org/docs.cgi?vers=cppv3&page=classes),  the Tensor Decompositions link mentions density matrix diagonalization in the brief description next to it. The Tensor Decompositions page is also the first thing to show up in the specialized Google search when I typed "density matrix diagonalization."

Best,
Jared
commented by (210 points)
Hi Jared,

I'm using Julia , I should have said that.

I am sorry to hear that you assume I didn't check the documentation. Unfortunately I already did what you said, but I'm not quite sure how to handle the indices and extract the eigenvalues corresponding to a given QN sector.
I seem not to find the results I expect and that I get using ED (Exact Diagonalization).

Assuming to have a bosonic site, using an SVD on MPS I can get then singular values corresponding to QN("Nb",q) where q is the fixed number of bosons, just working on the index of the tensor.  In the case of the density matrix, after the outer product the indices contain bot positive and negative q's, because they should be corresponding to the QN flux, namely how much a given block changes the quantum number when acting on an MPS. I don't know how to select the eigenvalues of a sector (the physical sector corresponding to the projection of the density matrix in the subspace with fixed number of bosons), from a theoretical point of view.

Best,
Vittorio
commented by (480 points)
Hi Vittorio,

Ah. I misunderstood your original post. I should not multi-task when looking at the ITensor forum.

You're looking for the entanglement entropy within a given number of bosons on one side of a cut and extend the work you had from https://www.itensor.org/support/2879/extract-project-iqtensor-on-a-qn-subspace?show=2879#q2879 ?

Best,
Jared
commented by (210 points)
Dear Jared,

the answer is yes. Instead of building the reduced density matrix, which is what I did after asking the question before, I would like to obtain directly the entanglement spectrum of the reduced density matrix.

My idea initially was to calculate it from the MPS and using an SVD. Unfortunately, It works but it's not what I need in my particular case.

I need to start from a density matrix (written as an MPO) and I have to calculate the entanglement spectrum of half the system. In this case, however, since I start from an MPO I have not been able so far to understand how to select the entanglement spectrum for a given value of the QN  and if it is possible in the sense I'm picturing it.

Best,
Vittorio

I don't know if I have been more
commented by (70k points)
Hi Vittorio,
To understand your question a bit better, are you actually writing your state (density matrix) as an MPO? Meaning is it strictly necessary?

What I see in your question is that rho is a sum of outer products of pure states, which I guess you have an MPS representation of (of the pure states I mean). So the psi_i are each separate MPS in your question, correct?

If so, then I think I know an efficient way to get the von Neumann entanglement of both rho and psi, involving sums and overlaps of pieces of the different MPS.

But I wanted to clarify if that was your more general question, or specifically that you are in a situation where you must obtain the entropy from an MPO?

Thanks,
Miles
commented by (210 points)
Hi Miles,

I have the MPS of each trajectory and I have to calculate the entanglement/Renyi entropy "averaged", in a given QN Sector, namely in a subspace at fixed quantum number, i e. Number of bosons.

I realized that in order to match the results I obtain with ED (solving the Schroedinger equation) , I have to compute the averaged density matrix at each time step and calculate the entanglement spectrum from it. I cannot proceed with the calculation on each MPS and average afterwards.

This Is the reason why I was asking how to do that for an MPO.

I hope my problem is better explained now.

Vittorio

+1 vote

Thanks for the clarification above. So I can think of 3 ways to proceed or ways to approach this (I'd recommend #1 if applicable):

1. given an MPO as a starting point, representing a density matrix, it's straightforward to compute the second Renyi entropy of a subregion A consisting of sites 1...N_A. So if you could use the second Renyi entropy instead of von Neumann entropy I could tell you more about how to obtain that from an MPO including drawing some diagrams to show you the idea.

2. in general, I don't know of an efficient way to get the von Neumann entropy for a subregion A described by a density matrix in the form of an MPO. I think it's actually an open topic of research, and there may need to be different algorithms for different cases like e.g. whether the density matrix is similar to a low or high temperature one. It's complicated I think, and there's no 'standard' approach here.

3. there is an alternative quantity you could consider if it suits your purposes, which is to view the MPO as an MPS with doubled sites. It's the mapping often called "purifying" the state (mapping a mixed state to a pure state). But the entanglement of that pure state is not the same thing, as you may know, as the entanglement of the mixed state interpreted as a density matrix. Yet it can be a helpful quantity to study. For example, here is a paper that uses this measure of "entanglement" of operators (MPOs) which they mention in the caption of Fig. 1: https://arxiv.org/pdf/1802.00801.pdf

Hope that helps & we can discuss #1 some more or if you have remaining questions about #2.

Miles

commented by (210 points)
Hi Miles,

I think point 1 is applicable, I can focus on Renyi-2 entropy or on the purity of the density matrix (which is equivalent I guess), it is not a problem.
I was aware of point 3 but it's not exactly what I need.

If you could elaborate more on point 1 or guide me in some way  I'd gladly appreciate it.

Best,
Vittorio
commented by (70k points)

Hi Vittorio,
As we discussed, one option is to compute the second Renyi entropy of a density matrix which is represented as an MPO. This can be done efficiently; I believe the von Neumann entropy is more complicated and harder to obtain.

Here is a short note I made about how to obtain the second Renyi entropy of an MPO:

https://itensor.org/RenyiMPO.pdf

Please let me know if you have questions of course. To perform the traces, you can use the "delta" function in ITensor to make an identity or Kronecker delta ITensor, and contract it with each MPO tensor you want to trace.

Miles

commented by (210 points)
edited by
Hi Miles,

thank you for the heads up. I did what you suggested already for the full Renyi entropy, however I encounter some problems when focusing on a given QN sector.

Usually I built the reduced density matrix in a given sector with the following function:

function RDMq(ψ, N, sites, site1,site2, QNlist)

orthogonalize!(ψ,site1,svd_alg="qr_iteration")
ψdag = dag(ψ)
ρA = prime(ψ[site1],r1)*prime(ψdag[site1],"Site")

for j in site1+1:site2-1
ρA *= prime(prime(ψ[j],lj),rj)
ρA *= prime(ψdag[j],"Site")
end
ρA *= prime(ψ[site2],l2)
ρA *= prime(prime(ψdag[site2],"Site"),r2p)
deltaTensor=deltaQ(r2,r2p,QNlist)
ρA *= deltaTensor
C=calc_trace(ρA,site1,site2)
return ρA*(1/real(C))
end

where @@ \psi @@ is an MPS  and deltaTensor is obtained as explained in the previous question I asked http://itensor.org/support/2879/extract-project-iqtensor-on-a-qn-subspace?show=2879#q2879.

As you see it starts from an MPS. I don't know how to generalise it for an MPO or how to perform a projection of the MPO in a given sector in alternative ways. This is also the reason why I asked if I could perform an SVD or something different.

Best,
Vittorio

EDIT: It seems I can't write in LaTeX properly.

EDIT2: A problem aside from the one discussed here is that constructing the density matrices of different trajectories of the dynamics, according to what I wrote above, and summing them gives me a "getindex" error. Otherwise this last approach might be feasible. Nonetheless it is not efficient since the complexity of the construction I wrote above should be exponential in the dimension of the subsystem (site2-site1).
commented by (70k points)
Hi Vittorio,
So the way to generalize a code like this to an MPO (when the MPO has the interpretation of a density matrix) is to view your original code as also actually working already for a special class of "MPO" which is nothing but \psi * \psi^\dagger. If you draw this diagrammatically you will see it looks like an MPO but with a "double line" structure for the virtual or link indices running through the MPO.

Going back to an actual MPO, quantities like your \rho_A which here you make by outer-producting psi and dag(psi) in the MPO case would be obtained by tracing all of the MPO tensors N, N-1, N-2, ..., 2 and contracting those resulting matrices together and finally multiplying the result into the first MPO tensor. The same thing is implicitly happening in the MPS case, but there you are using the assumption that the MPS is right-orthogonal to skip over all those contractions which cancel to the identity anyway, and just contract the first MPS tensor with itself along the virtual index.

Hope that helps you to get started and make more progress.

Miles