Skip to content

Commit e67918c

Browse files
committed
Fix normalization of boundary gamma tensors
1 parent 6457a21 commit e67918c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/MPS.jl

+13
Original file line numberDiff line numberDiff line change
@@ -776,5 +776,18 @@ function LinearAlgebra.normalize!(::Canonical, ψ::AbstractMPO; bond=nothing)
776776
Γ ./= Z
777777
end
778778

779+
# normalize the first and last Γ tensors
780+
Γ = tensors(ψ; at=lane"1")
781+
Λ = tensors(ψ; bond=(lane"1", lane"2"))
782+
ρ = contract(Γ, Λ; dims=Symbol[])
783+
Z = norm(ρ)
784+
Γ ./= Z
785+
786+
Γ = tensors(ψ; at=Lane(nlanes(ψ)))
787+
Λ = tensors(ψ; bond=(Lane(nlanes(ψ) - 1), Lane(nlanes(ψ))))
788+
ρ = contract(Γ, Λ; dims=Symbol[])
789+
Z = norm(ρ)
790+
Γ ./= Z
791+
779792
return ψ
780793
end

0 commit comments

Comments
 (0)