Skip to content

Commit

Permalink
Eliminate another allocation in CachingSolver's solve
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Dec 7, 2016
1 parent dbf849f commit dd6db79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ hasconverged(solver::CachingSolver) = hasconverged(solver.basesolver)
needediterations(solver::CachingSolver) = needediterations(solver.basesolver)

function solve(solver::CachingSolver, p)
best_diff = sumabs2(p - get_extrapolation_origin(solver.basesolver)[1])
origin_p = get_extrapolation_origin(solver.basesolver)[1]
best_diff = 0.0
for i in eachindex(origin_p)
best_diff += abs2(p[i] - origin_p[i])
end
idx = 0
for i in (solver.num_ps-solver.new_count+1):solver.num_ps
diff = 0.
Expand Down

0 comments on commit dd6db79

Please sign in to comment.