Cannot compute dot product of ITensors due to mismatch of indices.

Can you turn your example code into something we can run ourselves, for example by also including in your script example (maybe random) ITensors that you would put into that function, and how you would call that function with those random ITensor inputs? As an example, see how I turned your previous post into a minimal runnable example here: How to update a tensor element-wise in ITensors ? - #5 by mtfishman.

I’ve asked you multiple times in previous posts you have made that when you share example code that you should share code that we can run ourselves, and that is also instructed in Please Read: Make It Easier to Help You which I have pointed out to you to read multiple times. What that means is that we should be able to copy and paste your code exactly as you have written it, and it will run on our computers, say if we copy and paste your code into a file and run the file in Julia with include("..."). We’re happy to help, but please help us help you.

As you have identified, dot only works on ITensors that share indices, so you could either make sure that the ITensor indices match from the start, or make them match by contracting with delta tensors or using a function such as replaceinds to replace the indices of one ITensor to make them match with the other one.

1 Like