Skip to content

Commit cd7ee2c

Browse files
Fix FixedSpaceTruncation for simple update (#202)
1 parent 1c1d1f7 commit cd7ee2c

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/algorithms/time_evolution/evoltools.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ function _apply_gate(
141141
trscheme::TruncationScheme,
142142
) where {T<:Number,S<:ElementarySpace}
143143
@tensor a2b2[-1 -2; -3 -4] := gate[-2 -3; 1 2] * a[-1 1 3] * b[3 2 -4]
144-
return tsvd!(
145-
a2b2;
146-
trunc=((trscheme isa FixedSpaceTruncation) ? truncspace(space(a, 3)) : trscheme),
147-
alg=TensorKit.SVD(),
148-
)
144+
trunc = if trscheme isa FixedSpaceTruncation
145+
V = space(b, 1)
146+
truncspace(isdual(V) ? V' : V)
147+
else
148+
trscheme
149+
end
150+
return tsvd!(a2b2; trunc, alg=TensorKit.SVD())
149151
end
150152

151153
"""

src/algorithms/time_evolution/simpleupdate3site.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ function _get_allprojs(Ms, Rs, Ls, trunc::TensorKit.TruncationScheme, revs::Vect
239239
N = length(Ms)
240240
projs_errs = map(1:(N - 1)) do i
241241
trunc2 = if isa(trunc, FixedSpaceTruncation)
242-
truncspace(space(Ms[i + 1], 1))
242+
V = space(Ms[i + 1], 1)
243+
truncspace(isdual(V) ? V' : V)
243244
else
244245
trunc
245246
end

0 commit comments

Comments
 (0)