Skip to content

Commit 48413d2

Browse files
authored
change truncation strategy to always select smallest schmidt coefficient (#188)
* change truncation strategy to always select smallest schmidt coefficient * fix properly
1 parent 9f553b0 commit 48413d2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/tensors/truncation.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ function _findnexttruncvalue(Σdata, truncdim::SectorDict{I,Int}, p::Real) where
128128

129129
# find some suitable starting candidate
130130
cmin = findfirst(>(0), truncdim)
131-
weightedσmin = dim(cmin)^inv(p) * Σdata[cmin][truncdim[cmin]]
131+
σmin = Σdata[cmin][truncdim[cmin]]
132132

133133
# find the actual minimum singular value
134134
for (c, σs) in Σdata
135135
if truncdim[c] > 0
136-
weightedσ = dim(c)^inv(p) * σs[truncdim[c]]
137-
if weightedσ < weightedσmin
138-
cmin, weightedσmin = c, weightedσ
136+
σ = σs[truncdim[c]]
137+
if σ < σmin
138+
cmin, σmin = c, σ
139139
end
140140
end
141141
end
@@ -148,14 +148,14 @@ function _findnextgrowvalue(Σdata, truncdim::SectorDict{I,Int}, p::Real) where
148148

149149
# find some suitable starting candidate
150150
cmax = findfirst(istruncated)
151-
weightedσmax = dim(cmax)^inv(p) * Σdata[cmax][truncdim[cmax] + 1]
151+
σmax = Σdata[cmax][truncdim[cmax] + 1]
152152

153153
# find the actual maximal singular value
154154
for (c, σs) in Σdata
155155
if istruncated[c]
156-
weightedσ = dim(c)^inv(p) * σs[truncdim[c] + 1]
157-
if weightedσ > weightedσmax
158-
cmax, weightedσmax = c, weightedσ
156+
σ = σs[truncdim[c] + 1]
157+
if σ > σmax
158+
cmax, σmax = c, σ
159159
end
160160
end
161161
end

0 commit comments

Comments
 (0)