File tree 1 file changed +20
-7
lines changed
1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -729,15 +729,28 @@ end
729
729
730
730
# this method just normalizes the Λ tensors
731
731
function LinearAlgebra. normalize! (:: Canonical , ψ:: AbstractMPO ; bond= nothing )
732
- if isnothing (bond)
733
- for i in 1 : (nlanes (ψ) - 1 )
734
- Λ = tensors (ψ; bond= (Lane (i), Lane (i + 1 )))
735
- normalize! (Λ)
736
- end
737
- else
738
- Λ = tensors (ψ; bond)
732
+ if ! isnothing (bond)
733
+ # Λ = tensors(ψ; bond)
734
+ # normalize!(Λ)
735
+ error (" Forced normalization of just one bond is not implemented yet" )
736
+ end
737
+
738
+ # normalize the Λ tensors
739
+ for i in 1 : (nlanes (ψ) - 1 )
740
+ Λ = tensors (ψ; bond= (Lane (i), Lane (i + 1 )))
739
741
normalize! (Λ)
740
742
end
741
743
744
+ # normalize the Γ tensors
745
+ for i in 2 : (nlanes (ψ) - 1 )
746
+ Γ = tensors (ψ; at= Lane (i))
747
+ Λᵢ₋₁ = tensors (ψ; bond= (Lane (i - 1 ), Lane (i)))
748
+ Λᵢ₊₁ = tensors (ψ; bond= (Lane (i), Lane (i + 1 )))
749
+
750
+ # NOTE manual binary contraction due to bugs in `contract(args...)`
751
+ Z = norm (contract (contract (Γ, Λᵢ₋₁; dims= Symbol[]), Λᵢ₊₁; dims= Symbol[]))
752
+ Γ ./= Z
753
+ end
754
+
742
755
return ψ
743
756
end
You can’t perform that action at this time.
0 commit comments