Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling delta on same indices fails with obscure error #332

Open
Jack-Kemp opened this issue Feb 22, 2020 · 1 comment
Open

Calling delta on same indices fails with obscure error #332

Jack-Kemp opened this issue Feb 22, 2020 · 1 comment

Comments

@Jack-Kemp
Copy link
Contributor

  Index u(2);
  auto p = randomITensorC(u, prime(u))*delta(u, u);

Running compiled with debug flags gives me the error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  index out of range in InfArray

I ran into this while combining indices programmatically and while obviously a huge corner case it would have been helpful to know what the problem was.

I can push a fix, but is the intent that a) delta(u,u) should throw an error, or b) that it should return ITensor(1) or something to that effect? Or c) is any sort of check left out for optimisation purposes and the behaviour as-is intended? To me b) seems most intuitive.

@mtfishman
Copy link
Member

Hello,

This is meant to be an error (defining any ITensor with repeated indices is not well defined behavior). It would definitely be good to have a better error message, at least in debug mode.

Cheers,
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants