Hi,
Thanks for your reply. But I am still having one issue as follows:
I generate the \Lambda as follows (denote by M in the code)
N = 6
s = siteinds(“S=1/2”,N)
psi = randomMPS(s; linkdims=2)
M = ITensors.MPS(s)
l = Vector{Index}(undef,N)
chi, element = 1, [1.0]
for i=1:N-1
l1 , l2 = Index(chi,“Link,Left,l=(i)"), Index(chi,"Link,Right,l=(i)”)
T = reshape(element, (1,1))
M[i] = ITensor(T, l1,l2)
end
l1 = Index(chi,“Link,Left,l=$(N)”)
T = reshape(element, (1,1))
M[N] = ITensor(T,l1)
The psi created looks like
ITensors.MPS
[1] ((dim=2|id=100|“S=1/2,Site,n=1”), (dim=2|id=538|“Link,l=1”))
[2] ((dim=2|id=538|“Link,l=1”), (dim=2|id=770|“S=1/2,Site,n=2”), (dim=2|id=92|“Link,l=2”))
[3] ((dim=2|id=92|“Link,l=2”), (dim=2|id=382|“S=1/2,Site,n=3”), (dim=2|id=119|“Link,l=3”))
[4] ((dim=2|id=119|“Link,l=3”), (dim=2|id=167|“S=1/2,Site,n=4”), (dim=2|id=703|“Link,l=4”))
[5] ((dim=2|id=703|“Link,l=4”), (dim=2|id=283|“S=1/2,Site,n=5”), (dim=2|id=839|“Link,l=5”))
[6] ((dim=2|id=839|“Link,l=5”), (dim=2|id=494|“S=1/2,Site,n=6”))
And \Lambda looks like
ITensors.MPS
[1] ((dim=1|id=885|“Left,Link,l=1”), (dim=1|id=194|“Link,Right,l=1”))
[2] ((dim=1|id=729|“Left,Link,l=2”), (dim=1|id=735|“Link,Right,l=2”))
[3] ((dim=1|id=403|“Left,Link,l=3”), (dim=1|id=825|“Link,Right,l=3”))
[4] ((dim=1|id=432|“Left,Link,l=4”), (dim=1|id=369|“Link,Right,l=4”))
[5] ((dim=1|id=616|“Left,Link,l=5”), (dim=1|id=992|“Link,Right,l=5”))
[6] ((dim=1|id=307|“Left,Link,l=6”),)
Now, when I try the multiply MPS at some site (for instance site =3) with the \Lambda just to its right (i.e, \Lambda sitting on right side bond), I get
print(psi[3]*M[3])
ITensor ord=5
Dim 1: (dim=2|id=92|“Link,l=2”)
Dim 2: (dim=2|id=382|“S=1/2,Site,n=3”)
Dim 3: (dim=2|id=119|“Link,l=3”)
Dim 4: (dim=1|id=403|“Left,Link,l=3”)
Dim 5: (dim=1|id=825|“Link,Right,l=3”)
ITensors.NDTensors.Dense{Float64, Vector{Float64}}
2×2×2×1×1
[:, :, 1, 1, 1] =
0.8997157483855767 -0.3258873572108523
0.25694720924808373 -0.058385953136905755
[:, :, 2, 1, 1] =
0.01238106719578167 -0.2900960387392452
-0.46996470968106846 0.8424383560773483
clearly, I get a 5 index tensor instead of 3 and as seen the common leg is not contracted. This is
(so far as I understand) because the id numbers are different for their “common leg”. How should I modify in construction of \Lambda such that contractions and other operations can be implemented correctly?