0 votes
asked by (180 points)

Hi,
I'm trying to calculate the negativity (see section VI of this paper) for 1D systems. To this end I need to find the eigenvalues of the partial transpose of a tensor. In simple words, if my tensor has 4 indexes (i,j,i',j'), then I need to find the eigenvalues of the matrix whose indexes are (i, j') and (i',j) (instead of (i,j) and (i',j')).
Now in order to use the method diagHermitian I have to change the prime level of the indexes, so what I've done is this:

//The indexes of the tensor E12 to be swapped:
auto icl = commonIndex(E12 , psi.A(rlim1+1));
auto iclp = commonIndex(E12, prime(dag(psi.A(rlim1+1)),Link));
//I guess I could've done: auto iclp=prime(icl); as well.
//Now I have the indexes, and I want to swap the prime level:
E12.prime(icl,4);
icl.prime(4);//This is necessary for icl being related to the corresponding index in E12.
E12.prime(iclp,-1);
iclp.prime(-1);
E12.prime(icl,-3);
icl.prime(-3);
         //Now the left index of E12 is swapped:
         //the prime level (0,1) --> (1,0).
         //The index named iclp is not primed, and icl is primed.
IQTensor U,D;
diagHermitian(E12,U,D);

Now this looks quite cumbersome to me. So my (least important) questions are:
1. Is there a better way to swap the indexes? swapPrime wouldn't help, because I have another index (of the same type, namely j,j') which must stay untouched.
2. Is there a simple way to force diagHermitian to group the indexes as I wish instead of the usual way? This will make the swapping unnecessary, of course.

Now my more pressing question is about a case where the tensor to be partially transposed is a product of two diagonal matrices (the S matrix of a svd). The product is supposed to be such that the result will have 4 indexes, because only that way the partial transpose is defined. So my question is:
3. Is there a simple way to convert a diag matrix to a dense one? Alternately, is there a way to do diag*diag --> dense (with 4 indexes) ?

Thanks a lot for all the wonderful work!
I'm really enjoying this library, although I have no former experience in c++!
Yishai

related to an answer for: Contraction of two sparse tensors

Please log in or register to answer this question.

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...