Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Mar 6, 2024
1 parent 6f68b2a commit 390341f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ end

resids = map(x -> Symbol("$(x)_resid"), cache_syms)
for (sym, resid) in zip(cache_syms, resids)
push!(calls, :($(resid) = get_fu($(sym))))
push!(calls, :($(resid) = @isdefined($(sym)) ? get_fu($(sym)) : nothing))
end
push!(calls,
quote
fus = tuple($(Tuple(resids)...))
minfu, idx = __findmin(cache.internalnorm, fus)
idx += cache.alg.start_index - 1
stats = __compile_stats(cache.caches[idx])
u = get_u(cache.caches[idx])
retcode = cache.caches[idx].retcode
Expand Down Expand Up @@ -225,13 +224,12 @@ for (probType, pType) in ((:NonlinearProblem, :NLS), (:NonlinearLeastSquaresProb

resids = map(x -> Symbol("$(x)_resid"), sol_syms)
for (sym, resid) in zip(sol_syms, resids)
push!(calls, :($(resid) = $(sym).resid))
push!(calls, :($(resid) = @isdefined($(sym)) ? $(sym).resid : nothing))
end

push!(calls, quote
resids = tuple($(Tuple(resids)...))
minfu, idx = __findmin(DEFAULT_NORM, resids)
idx += alg.start_index - 1
end)

for i in 1:N
Expand Down
1 change: 1 addition & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function __findmin_caches(f, caches)
end
function __findmin(f, x)
return findmin(x) do xᵢ
xᵢ === nothing && return Inf
fx = f(xᵢ)
return isnan(fx) ? Inf : fx
end
Expand Down
4 changes: 1 addition & 3 deletions test/misc/polyalg_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ end
Broyden(; autodiff = AutoFiniteDiff()), LimitedMemoryBroyden()))

# Uses the `__solve` function
solver = solve(probN; abstol = 1e-9)
@test SciMLBase.successful_retcode(solver)
@test_throws MethodError solve(probN; abstol = 1e-9)
@test_throws MethodError solve(probN, RobustMultiNewton(); abstol = 1e-9)
@test SciMLBase.successful_retcode(solver)
solver = solve(probN, RobustMultiNewton(; autodiff = AutoFiniteDiff()); abstol = 1e-9)
@test SciMLBase.successful_retcode(solver)
solver = solve(
Expand Down

0 comments on commit 390341f

Please sign in to comment.