0 votes
asked by (300 points)

Hi,

I am trying to implement TDVP method using ITensor. TDVP requires an approximate Krylov method to get the matrix exponential, which is considerably faster than exact diagonalization technique, eg. expHermitian, especially at large bond dimension.

Can you please suggest a library or give a reference of the algorithm, that is well suited for ITensor library (for both ITensor and IQTensor)?

Another thing, can you please tell me about the way to efficiently extract the data of an ITensor (or IQTensor) as a 2D array (like the ones, used in Eigen or Armadillo, or native C++ dynamic array), and then put it back into ITensor (or IQTensor)? Currently, I am doing brute force method using loops to copy/insert the data from/in ITensor (or IQTensor).

Thanking you,
Titas

1 Answer

0 votes
answered by (70.1k points)

Hi Titas,
Regarding Krylov, this is a good idea for a low-level algorithm we should supply with ITensor. However, this is in addition to many other things we should or would like to add (tensor slicing, other algorithms, etc) so it may take some time for us to add Krylov.

But in the meantime, it is something that should be quite possible to implement yourself. Good examples of similar algorithms written in ITensor can be found in this file:
https://github.com/ITensor/ITensor/blob/master/itensor/iterativesolvers.h
In that file there are the Arnoldi, gmres, and Davidson algorithms.

These all follow similar principles, which is that one multiplies a large linear operator onto an initial 'state' or vector, then orthogonalizes the resulting produced vector against all previously produced vectors from earlier in the algorithm to build a Krylov subspace. Then one solves the desired problem, whether an eigenvalue or Ax=b problem etc., within the Krylov space.

The key operations of ITensor taking place in each of these algorithms are just contracting ITensors together (used when multiplying the vectors by the large linear operator and dot-producting the vectors with each other) and addition of ITensors. Most of the code is just dealing with scalars and small matrices to enact the logic of the algorithm, and to check for convergence and things.

Finally, regarding extracting the data of a dense ITensor, you can refer to this code formula page:
http://itensor.org/docs.cgi?vers=cppv2&page=formulas/extractdense
Please ask if you have a question about that page.

Unfortunately, things aren't as simple for extracting storage of block-sparse tensors i.e. IQTensors. I could give you a similar code to the above that would extract the low level storage of an IQTensor, but you'd still need to know how this storage is organized to read out the different blocks properly. Let me know if you definitely decide you need to do that. But it could be easier to just convert the IQTensor to a dense ITensor and then read that out instead.

Best regards,
Miles

commented by (300 points)
Hi Miles,

Thanks for the answers. I have written a simple Lanczos exponentiation using a LocalOp like class with .product() method, and it works well for TDVP methods.

For the data extraction, I believe, I will stick to ITensors for now and use doTask() method.

Thanks again for the reply.

With regards,
Titas
commented by (70.1k points)
That's great to hear & glad you got that working. Thanks for the update -
commented by (390 points)
Hello,

regarding
"Finally, regarding extracting the data of a dense ITensor, you can refer to this code formula page:
http://itensor.org/docs.cgi?vers=cppv2&page=formulas/extractdense
Please ask if you have a question about that page."

I have some problems understanding the content of this page. In particular, what would be the procedure to extract the  data of a ITensor with unprimed and primed indices as a 2d matrix and a ITensor as only unprimed indices as a vector?
Thanks a lot!
Jacopo
commented by (70.1k points)
Hi Jacopo, the code on that page takes a given ITensor, with any pattern of indices, whether primed or unprimed, and then reads out its storage. So the only role of the indices is to show you how to interpret the data, based on how the indices are ordered. Whether an index is primed or not does not change its size nor its order as one of the indices of the tensor it belongs to, so shouldn't need to be a consideration when it comes to reading out the data.

Best regards,
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.

Categories

...