Skip to content

Commit 9f4a339

Browse files
committed
Consider strategy.rev
1 parent e4aa683 commit 9f4a339

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/factorizations/truncation.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,8 @@ function MAK.findtruncated(values::SectorVector, strategy::TruncationByOrder)
171171

172172
# dimensions are all 1 so no need to account for weight
173173
if FusionStyle(I) isa UniqueFusion
174-
if length(parent(values)) <= strategy.howmany
175-
return MAK.findtruncated(values, NoTruncation())
176-
end
177-
perm = partialsortperm(parent(values), 1:strategy.howmany; strategy.by, strategy.rev)
174+
howmany = min(length(parent(values)), strategy.howmany)
175+
perm = partialsortperm(parent(values), 1:howmany; strategy.by, strategy.rev)
178176
result = similar(values, Bool)
179177
fill!(parent(result), false)
180178
parent(result)[perm] .= true
@@ -186,9 +184,6 @@ function MAK.findtruncated(values::SectorVector, strategy::TruncationByOrder)
186184
for (c, v) in pairs(dims)
187185
fill!(v, dim(c))
188186
end
189-
if sum(dims) <= strategy.howmany
190-
return MAK.findtruncated(values, NoTruncation())
191-
end
192187

193188
# allocate logical array for the output
194189
result = similar(values, Bool)

0 commit comments

Comments
 (0)