Yes when I check the indices they do match for the sites but are different for the links (I was under the impression the link indices do not need to match?), yet when I do ‘inner’ between them, which should be exactly zero, I still get an error about site indices not matching.
For instance:
N = 3
s = siteinds("Qubit", N; conserve_qns=true)
state = [n<=2 ? "Dn" : "Up" for n=1:N-1]
r = randomMPS(s[2:N], state; linkdims=2)
psi_temp = MPS(s,"0")
for i in 2:N
psi_temp[i]=r[i-1]
end
psi1 = psi_temp
state = [n<=1 ? "Dn" : "Up" for n=1:N-1]
r = randomMPS(s[2:N], state; linkdims=1)
psi_temp = MPS(s,"0")
for i in 2:N
psi_temp[i]=r[i-1]
end
psi2 = psi_temp
s1 = siteinds(psi1)
s2 = siteinds(psi2)
for j=1:length(psi1)
replaceind!(psi1[j],s1[j],s2[j])
end
@show siteinds(psi1)
@show siteinds(psi2)
println()
@show linkinds(psi1)
@show linkinds(psi2)
println()
@show inner(psi1', psi2)
Gives the error:
siteinds(psi1) = Index{Vector{Pair{QN, Int64}}}[(dim=2|id=763|"Qubit,Site,n=1") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=2|id=146|"Qubit,Site,n=2") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=2|id=350|"Qubit,Site,n=3") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1]
siteinds(psi2) = Index{Vector{Pair{QN, Int64}}}[(dim=2|id=763|"Qubit,Site,n=1") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=2|id=146|"Qubit,Site,n=2") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=2|id=350|"Qubit,Site,n=3") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1]
linkinds(psi1) = Union{Nothing, Index{Vector{Pair{QN, Int64}}}}[nothing, (dim=2|id=954|"Link,l=1") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1]
linkinds(psi2) = Union{Nothing, Index{Vector{Pair{QN, Int64}}}}[nothing, (dim=1|id=527|"Link,l=1") <In>
1: QN("Parity",1,2) => 1]
Calling `dot(ϕ::MPS/MPO, ψ::MPS/MPO)` with multiple site indices per MPS/MPO tensor but the site indices don't match. Even with `make_inds_match = true`, the case of multiple site indices per MPS/MPO is not handled automatically. The sites with unmatched site indices are:
inds(ϕ[1]) = ((dim=2|id=763|"Qubit,Site,n=1")' <In>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=1|id=652|"Link,l=1")' <Out>
1: QN("Parity",0,2) => 1)
inds(ψ[1]) = ((dim=2|id=763|"Qubit,Site,n=1") <Out>
1: QN("Parity",0,2) => 1
2: QN("Parity",1,2) => 1, (dim=1|id=343|"Link,l=1") <In>
1: QN("Parity",0,2) => 1)
Make sure the site indices of your MPO/MPS match. You may need to prime one of the MPS, such as `dot(ϕ', ψ)`.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] deprecate_make_inds_match!(::typeof(ITensors._log_or_not_dot), M1dag::MPS, M2::MPS, loginner::Bool; make_inds_match::Bool)
@ ITensors ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1040
[3] _log_or_not_dot(M1::MPS, M2::MPS, loginner::Bool; make_inds_match::Bool)
@ ITensors ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1068
[4] _log_or_not_dot
@ ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1059 [inlined]
[5] #dot#664
@ ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1115 [inlined]
[6] dot
@ ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1114 [inlined]
[7] #inner#666
@ ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1157 [inlined]
[8] inner(M1::MPS, M2::MPS)
@ ITensors ~/.julia/packages/ITensors/5CAqA/src/mps/abstractmps.jl:1157
[9] top-level scope
@ show.jl:1047
[10] eval
@ ./boot.jl:368 [inlined]
[11] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1428