+1 vote
asked by (130 points)

Hi,

I ran into what might be a bug with the eigendecomposition function eigen() in ITensors.jl. Depending on the order of the Indices in my ITensor, eigen() gives me an error or not. Here is a minimum working code that gives me an error:

using ITensors

i1 = Index(1); i2=Index(2); i3=Index(3);
T = randomITensor(i1', i2, i3, i2', i3', i1)
F = eigen(T) # ERROR: In eigen, indices must come in pairs with equal spaces.

(I am using eigen()'s default behavior that the primed indices are the "left" indices and the rest are the "right" indices.) Note that the order of Indices that I provide to T is important. For example, the code below does not produce an error:

using ITensors

i1 = Index(1); i2=Index(2); i3=Index(3);
T = randomITensor(i2, i3, i2', i3', i1', i1)
F = eigen(T) # no error

Any suggestions on how to avoid this issue or what could be going wrong?

commented by (70.1k points)
Hi Eli,
Thanks for the helpful bug report. After digging into it for a minute, it looks like an issue with an incorrectly written error check in that function (so not like a deep bug, but more like some code meant to check for correctness which is itself not correct).

For now a workaround could be to use the permute! function to put the primed indices in the same order as the unprimed ones (so like i1, i2, i3, i1', i2', i3').

Best,
Miles
commented by (70.1k points)
And of course we will work on fixing this!
commented by (130 points)
Hi Miles,

I see, thanks for looking into it! For my use-case, I could instead use the svd() function which worked correctly, but I will keep permute!() in mind when I use eigen() in the future. And I will keep an eye out for the future bug fix :) Thanks!

Best,
Eli

1 Answer

0 votes
answered by (70.1k points)

Thanks again. We've filed this as a bug and will fix it: https://github.com/ITensor/ITensors.jl/issues/721

Glad you have a workaround in the meantime!

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

...