Contraction of two sparse tensors

+1 vote
asked Aug 31 by abenassen (130 points)

I am trying to implement a simple version of iTebd. I defined a class which involves tensors Gamma with three indexes and tensors Lambda, which are real diagonal and contain the Schmidt eigenvalues. I have one of these tensors for each site in the elementary cell.

In order to exploit the advantage of having Lambda diagonal, I defined them using diagTensor.

In performing products of these tensors, I encountered the situation where I needed to change the indexes of one Lambda tensor. Therefore I performed the contraction with the sparse tensor delta.

However, I was surprised by the runtime error that I got when performing this contraction:

libc++abi.dylib: terminating with uncaught exception of type itensor::ITError: doTask not defined for task Contract and storage types DiagReal DiagReal

It seems that the product between two diagonal tensors is not implemented. Why is it so?

1 Answer

0 votes
answered Sep 8 by miles (16,940 points)

Hi, good question about this. The answer of why it's not implemented is that I didn't yet see an important use case for it and I thought it better to have it throw an error instead, to make sure users weren't accidentally multiplying together tensors they didn't mean to.

But the cases you mention are good uses. So I think I should define them, especially since I think internally the contractions can be done very efficiently due to the simple sparse structure.

So I'll add it to my list of priorities to get into ITensor. Please write back here or email me if a few weeks go by and I haven't added it, or if you need it for a particularly urgent reason.

Finally, if you are feeling motivated, you can try implementing this feature yourself. The diagonal sparse ITensors are implemented by the Diag storage class in itensor/itdata/diag.h. What is needed is a definition of the function doTask(Contract, Diag, Diag). It could be a bit tricky though because one might want to handle the case of two indices and the case of all diag values being the same separately. But the other methods defined there are mostly fairly straightforward to follow as examples I think.

Miles

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.
...