Skip to content

Commit

Permalink
change behaviour of getindex(::FiniteMPS, ::Int) when center is a b…
Browse files Browse the repository at this point in the history
…ond-tensor
  • Loading branch information
VictorVanthilt committed Dec 24, 2024
1 parent 4f332bb commit a662903
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/states/finitemps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,16 @@ Base.@propagate_inbounds function Base.getindex(ψ::FiniteMPS, i::Int)
checkbounds(ψ, i)
end

if isinteger(c)
return if i > Int(c)
ψ.AR[i]
elseif i == Int(c)
ψ.AC[i]
else
ψ.AL[i]
end
else # There is a bond-tensor at site c - 1/2
c = Int(c - 1 / 2)
return if i > Int(c)
ψ.AR[i]
else
ψ.AL[i]
end
if ishalfodd(c)
c -= 1 / 2
end

return if i > Int(c)
ψ.AR[i]
elseif i == Int(c)
ψ.AC[i]
else
ψ.AL[i]
end
end

Expand Down

0 comments on commit a662903

Please sign in to comment.