Index direction

Hi,

I’m new in using Julia version of the Itensors, but I’m not able to recover the result from the documentation

using ITensors
Index([QN("Sz", -1) => 1, QN("Sz", 1) => 1], "i"; dir = In)

gives me an error: In is not defined; Instead, I’m using dir = ITensors.Arrow(1) or dir = ITensors.Arrow(-1);
I’m I doing something wrong, or it is a bug?

Best,
Murod

Hi Murod,
Thanks for the question. You can write

Index([QN("Sz", -1) => 1, QN("Sz", 1) => 1], "i"; dir = ITensors.In)

to get the In variable from the ITensors module. Alternatively you can put:

import ITensors: In

at the top of your code if it doesn’t cause any problems.

The reason it’s not imported by default is that other packages also define the variable In, so it can cause problems sometimes if we imported it by default also.

1 Like

I see, thank you, Miles.
Best regards,
Murod

1 Like

It would be good to fix the documentation for this. The example given in the documentation and in ?Index fails, which shouldn’t happen.

In my case I was preparing lecture notes on QNs, etc and got held up by this.

Thanks for the reminder. I don’t think we should be encouraging users to use the dir keyword argument anyway, it is a bit “low level” and it is better to create an Index and then call dag on it. In practice, I can’t think of a time when dag wasn’t sufficient (except in a few places internally in the library). I’ll update the docs accordingly.