+1 vote
asked by (550 points)

Hi,

I use svd to decompose an ITensor T(dim: 256*400) with QN as:

U,S,V,spec = svd(T, i, maxdim=100)

However, sometimes the dimension of S is not 100. S is a matrix of dim 98*98, while spec contains 100 values.

Did anyone meet similar situations? I can share the data for the tensor I used if needed.

Thanks.

commented by (550 points)
edited by
I think this is because of the docut variable obtained from the function truncate of ITensor:

if n < origm
    docut = (P[n] + P[n + 1]) / 2
    if abs(P[n] - P[n + 1]) < 1E-3 * P[n]
      docut += 1E-3 * P[n]
    end
  end

This docut variable sometimes is larger than P[i] when i <= maxdim?

When there is degeneracy, there will also be problems?
commented by (70.1k points)
Hi, thanks for noticing this. It’s hard to tell if it is a bug since the QN case of the SVD can be rather complicated, and there may be some block structure that complicates things. Or it could just be a bug!

Would you be able to provide a minimal code to reproduce? Or an HDF5 file containing the tensor you are SVD’ing? (If HDF5 you could just email it to support@itensor.org.)

Thanks,
Miles
commented by (550 points)
Hi Miles, thanks for the quick response. Sorry, I am busy today, but I can send you the HDF5 file tomorrow.
commented by (70.1k points)
Thanks for the HDF5 files. I was able to open them successfully and reproduce exactly what you are seeing. Glad we added HDF5 support to ITensor, because being able to share data like this is really useful!

I will look more into your issue and see what I find. I agree it's probably some behavior of the truncation logic that you pointed out.

Finally, I note that the tensors of the MPS psi[5] and psi[6] have a link index between them that has the dimension of 98. So if phi was made as psi[5]*psi[6] then the true rank of phi is 98, meaning that the 99th and 100th eigenvalues should really be zero. But that is only if phi=psi[5]*psi[6]. If phi was updated such as used within DMRG for the "eigsolve" step, then of course phi could grow to have a larger rank like 100 or more.

Either way, I agree it's weird that eigs(spec) contains 100 values all above 1E-13 but when passing maxdim=100, and even I tried maxdim=100, cutoff=1E-16, that it still truncates to 98. So I will look into that!
commented by (70.1k points)
You are right that it is the code which adjusts docut by adding 1E-3*P[n] which is causing this behavior. So we are looking into it, and seeing what other cases that code was necessary for in the past.
commented by (550 points)
Thanks for the clarification. By the way, the tensor "phi" was indeed from the "eigsolve" without truncation, which means it is a full-rank matrix. Maybe a better strategy to do svd cut when given a "maxdim=100" is to use an integer number n=min(100,dim_of(S)) rather than using a real number docut?

1 Answer

+1 vote
answered by (70.1k points)
selected by
 
Best answer

Thanks again for the question. To close this question, we looked into this behavior and found that it is currently the expected behavior of the code, because of subtleties of truncating block-sparse tensors when there are degenerate, or nearly degenerate eigenvalues near the cutoff point (or requested maxdim value). Presumably there could be a different way to do things where the requested maxdim is always satisfied as long as the cutoff is small enough, but the library code would need to be significantly more complicated and there still might be some surprising “edge cases”.

So we will continue to think about this issue but will treat it as a future enhancement rather than a bug for now.

Miles

commented by (550 points)
Thanks for looking at this. The current svd is fine for me and has no practical trouble.
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

...