Hey I have two MPO objects that i created manually. The issue is I cant seem to merge these MPOs together properly whenever I call contract()
In particular say I have:
# Tensor for R_0_0_
function build_R_0_0_(index_map::Dict{String,Index}, sites)
A = reshape([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], (3, 2, 3))
T = ITensor(A, sites[1], index_map["restriction0_0_0"], sites[1]')
return T
end
# Tensor for R_0_1_
function build_R_0_1_(index_map::Dict{String,Index}, sites)
A = reshape([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], (3, 2, 2, 3))
T = ITensor(A, sites[2], index_map["restriction0_0_0"]', index_map["restriction0_0_1"], sites[2]')
return T
end
# Tensor for R_0_2_
function build_R_0_2_(index_map::Dict{String,Index}, sites)
A = reshape([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], (3, 2, 3))
T = ITensor(A, sites[3], index_map["restriction0_0_1"]', sites[3]')
return T
end
index_map["restriction0_0_0"] = Index(2, "Link,l=1")
index_map["restriction0_0_1"] = Index(2, "Link,l=2")
R_0_0_ = build_R_0_0_(index_map, s)
R_0_1_ = build_R_0_1_(index_map, s)
mpo1 = MPO([R_0_0_, R_0_1_, R_0_2_])
mpo2 = MPO([R_1_0_, R_1_1_, R_1_2_])
total_mpo = contract(mpo2', mpo1; cutoff=1e-16)
The problem is the resulting MPO looks like:
MPO
[1] ((dim=2|id=105|"Link,l=1")', (dim=3|id=498|"Qudit,Site,n=1")'', (dim=3|id=498|"Qudit,Site,n=1"), (dim=2|id=795|"Link,l=1"), (dim=1|id=284|"Link,l=1"))
[2] ((dim=2|id=105|"Link,l=1")'', (dim=2|id=766|"Link,l=2")', (dim=3|id=82|"Qudit,Site,n=2"), (dim=2|id=795|"Link,l=1")', (dim=2|id=823|"Link,l=2"), (dim=3|id=696|"Qudit,Site,n=2"), (dim=1|id=284|"Link,l=1"))
[3] ((dim=2|id=766|"Link,l=2")'', (dim=3|id=224|"Qudit,Site,n=3"), (dim=2|id=823|"Link,l=2")', (dim=3|id=696|"Qudit,Site,n=2"))
Unlike when we merge 2 arbitary MPOs created from an Opsum these operators bond dimensions have not been merged. How to get this contraction to work properly?
Note my issue is that it didn’t merge the bond dimensions into a single larger bond dimension like it should have generally.