Some good questions.
-
the reason for the two indices
(linkind(psi, b-1), s[b])
is that here we want the entanglement across bond b (dividing sites 1,2,…b from sites b+1,b+2,…N). The indexlinkind(psi, b-1)
represents the Hilbert space of all of the sitess[1]
,s[2]
, … ,s[b-1]
compressed together and then we also want to includes[b]
in the set of sites that we are factorizing to the left (onto the “U” of the SVD). If we did not includes[b]
in thesvd
function call, then it would go onto the “V” tensor afterward and the entanglement we would be computing would be for bondb-1
which isn’t what we want. -
the reason only
S
is needed to compute entanglement goes back to the definition of entanglement entropy. For a bipartition of the system into subsystems A and B, entanglement is defined by first taking a state |\Psi\rangle and factorizing it as
where the s_n are real, non-negative numbers such that \sum_n s^2_n=1 and the |u_n\rangle and |v_n\rangle are orthonormal bases for the A and B subsystems. This form is known as the Schmidt decomposition and it always exists. Then the entanglement is given by S_{vN} = -\sum_n s^2_n \log{s^2_n}. So if you look at the above Schmidt decomposition, it is nothing more than an SVD of the wavefunction (viewed as a huge matrix) and the von Neumann entanglement entropy S_{vN} only involves the singular values s_n of the SVD and not the U or V matrices which define the |u_n\rangle and |v_n\rangle states.
As to why this correspondence between singular values and Schmidt values (which define the entanglement) continues to hold for a state represented as an MPS when you just SVD a single MPS tensor, that has to do with the left and right orthogonality conditions imposed on the other MPS tensors which is done in the code above by calling orthogonalize!(psi,b)
. It’s not an obvious thing and I’m not explaining it fully here, but just pointing out that the MPS orthogonality is the reason you can just SVD a single tensor to get the Schmidt values (singular values) and compute the entanglement.
Hope that helps.