# Entanglement entropy of a finite block of a spin chain

Dear ITensor,

I know that half-chain entanglement entropy can be easily computed by putting the MPS into the mixed-gauge. But what if I'm interested in the entanglement entropy of a finite block of the chain, for example the entanglement entropy between the block from the 10th to the 20th sites and the rest of the chain? Is there any way that this entanglement entropy can be computed? Is it even possible in principle?

Thanks,
Yantao

Hi Yantao,
This is certainly possible to do in a way that scales exponentially with the number of sites in the region "A" whose entanglement you want to compute.

You can see this previous question as one discussion with some example code for the case of a two site region "A":
http://itensor.org/support/229/evaluate-block-entanglement-blocks-that-extend-the-lattice?show=229#q229

The basic idea is just to explicitly trace rho = psi^2 on all of the sites of region B, which is a trivial operation if the gauge center site is located inside of region A. Then if region A has Na sites, you will get its reduced density matrix as a tensor with 2*Na indices. You can diagonalize this tensor using the diagHermitian function.

There may be a better scaling algorithm in principle, but there is not one which has been published as far as I know. (E.g. one ambitious algorithm would be to try to find the eigenvalues of rho one-by-one using an iterative eigensolver such as Lanczos, where one would multiply an MPS onto rho and construct rho tensor-by-tensor each time to keep the scaling polynomial. But one might need to compute a lot of eigenvalues to get a good estimate of the entropy.)

Best regards,
Miles

commented by (46.8k points)
I forgot, but we also have a code formula on the website about a very closely related operation:
http://itensor.org/docs.cgi?vers=cppv2&page=formulas/mps_two_rdm
commented by (310 points)
Dear Miles, Thanks very much. This is very helpful!