Skip to content

Commit 0c91d02

Browse files
committed
save allocations in callbacks
1 parent b953d95 commit 0c91d02

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/PreProcess/PreProcessKARC.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ function preprocess(PData::PDataKARC, Hop, g, gNorm2, calls, max_calls, α)
1010

1111
nshifts = length(shifts)
1212
cb = (slv) -> begin
13-
ind = setdiff(1:length(shifts), findall(slv.not_cv))
14-
if length(ind) > 1
15-
for i in ind
16-
if (norm(slv.x[i]) / shifts[i] - α > 0)
17-
return true
18-
end
13+
for i in 1:length(shifts)
14+
if !slv.not_cv[i] && (norm(slv.x[i]) / shifts[i] - α > 0)
15+
return true
1916
end
2017
end
2118
return false

src/PreProcess/PreProcessTRK.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ function preprocess(PData::PDataTRK, Hop, g, gNorm2, calls, max_calls, α)
1515
if slv.converged[1]
1616
return norm(slv.x[1]) α
1717
else
18-
ind = setdiff(1:length(shifts), findall(slv.not_cv)) # findall(slv.converged)
1918
if length(ind) > 1
20-
for i in ind
21-
if (norm(slv.x[i]) - α > 0)
19+
for i in 1:length(shifts)
20+
if !slv.not_cv[i] && (norm(slv.x[i]) - α > 0)
2221
return true
2322
end
2423
end

0 commit comments

Comments
 (0)