146146
147147Bring updated `AC` and `C` tensors back into a consistent set of left or right canonical
148148tensors. This minimizes `∥AC_i - AL_i * C_i∥` or `∥AC_i - C_{i-1} * AR_i∥`. The optimal algorithm uses
149- `Polar()` decompositions, but `QR`-based algorithms are typically more performant. Note that
150- the first signature is slightly faster, as it avoids an intermediate transposition.
149+ `Polar()` decompositions, but `QR`-based algorithms are typically more performant.
150+
151+ !!! note
152+ Computing `AL` is slightly faster than `AR`, as it avoids an intermediate transposition.
151153"""
152154regauge!
153155
@@ -156,15 +158,30 @@ function regauge!(AC::GenericMPSTensor, C::MPSBondTensor; alg=QRpos())
156158 Q_C, _ = leftorth!(C; alg)
157159 return mul!(AC, Q_AC, Q_C' )
158160end
161+ function regauge!(AC::Vector{<:GenericMPSTensor}, C::Vector{<:MPSBondTensor}; alg=QRpos())
162+ for i in 1:length(AC)
163+ regauge!(AC[i], C[i]; alg)
164+ end
165+ return AC
166+ end
159167function regauge!(CL::MPSBondTensor, AC::GenericMPSTensor; alg=LQpos())
160168 AC_tail = _transpose_tail(AC)
161169 _, Q_AC = rightorth!(AC_tail; alg)
162170 _, Q_C = rightorth!(CL; alg)
163171 AR_tail = mul!(AC_tail, Q_C' , Q_AC)
164- return _transpose_front(AR_tail)
172+ return repartition!(AC, AR_tail)
173+ end
174+ function regauge!(CL:: Vector{<:MPSBondTensor} , AC:: Vector{<:GenericMPSTensor} ; alg= LQpos())
175+ for i in length(CL): - 1 : 1
176+ regauge!(CL[i], AC[i]; alg)
177+ end
178+ return CL
165179end
166180# fix ambiguity + error
167181regauge!(:: MPSBondTensor , :: MPSBondTensor ; alg= QRpos()) = error(" method ambiguity" )
182+ function regauge!(:: Vector{<:MPSBondTensor} , :: Vector{<:MPSBondTensor} ; alg= QRpos())
183+ return error(" method ambiguity" )
184+ end
168185
169186# Implementation
170187# --------------
0 commit comments