+1 vote
asked by (52.6k points)

I have a tensor T with indices i1, i2, i3, i4 and I want to compute its SVD U,S,V with indices i1 and i3 on U and i2 and i4 on V. How do I do this?

1 Answer

+2 votes
answered by (52.6k points)
selected by
 
Best answer

Here's some sample code to do this:

ITensor U(i1,i3), S, V;
svd(T,U,S,V);

That's all you need to do. Initializing U with indices i1 and i3 tells the svd routine that those indices (along with a new one connecting U to S) should appear on U after the svd. The remaining indices of T will go onto V.

If you want to do the SVD approximately, do this:

ITensor U(i1,i3), S, V;
svd(T,U,S,V,{"Cutoff=",1E-8,"Maxm=",200});
commented by (110 points)
Hi Miles,

Could you also explain what is the best way to go if the object  T is not an ITensor/IQTensor but a LocalMPO, which is a vector of ITensors. Simply calling svd doesn't work. Thanks in advance.
commented by (52.6k points)
Hi, so for an object like a LocalMPO we don't have a routine that will compute its SVD. The reason is that if a tensor is represented as a LocalMPO, or some similar object, then by definition it is a tensor which is too big to store and/or manipulate directly. Instead it is intended that the main operation you do with it is multiply other tensors by it through the .product method.

That means the most natural way to SVD such a tensor would be to find an iterative algorithm which will do it, then use the .product method as the key step in this iterative algorithm. For instance, if the LocalMPO was actually a square, symmetric "matrix" then you could use an iterative algorithm like davidson to obtain its largest few eigenvalues and then its singular values would be the square roots of these.

If you need help implementing such an iterative algorithm, or if there are some missing lapack operations you need I'd be happy to discuss details.
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

...