Skip to content

Commit 9c7728a

Browse files
committed
Loosen ortho type restriction
1 parent 1cd044a commit 9c7728a

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/states/ortho.jl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ end
146146
147147
Bring updated `AC` and `C` tensors back into a consistent set of left or right canonical
148148
tensors. 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
"""
152154
regauge!
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')
158160
end
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
159167
function 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
165179
end
166180
# fix ambiguity + error
167181
regauge!(::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

Comments
 (0)