diff --git a/src/nlsolve/halley.jl b/src/nlsolve/halley.jl index 934dc47..3469291 100644 --- a/src/nlsolve/halley.jl +++ b/src/nlsolve/halley.jl @@ -78,9 +78,8 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleHalley, args...; cᵢ = _restructure(cᵢ, cᵢ_) if i == 1 - if iszero(fx) + all(iszero(fx)) && return build_solution(prob, alg, x, fx; retcode = ReturnCode.Success) - end else # Termination Checks tc_sol = check_termination(tc_cache, fx, x, xo, prob, alg) diff --git a/src/nlsolve/trustRegion.jl b/src/nlsolve/trustRegion.jl index e6ccf65..7792f94 100644 --- a/src/nlsolve/trustRegion.jl +++ b/src/nlsolve/trustRegion.jl @@ -92,7 +92,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args. termination_condition) # Set default trust region radius if not specified by user. - Δₘₐₓ == 0 && (Δₘₐₓ = max(norm_fx, maximum(x) - minimum(x))) + Δₘₐₓ = ifelse(iszero(Δₘₐₓ), max(norm_fx, maximum(x) - minimum(x)), Δₘₐₓ) if Δ == 0 if _unwrap_val(alg.nlsolve_update_rule) norm_x = norm(x)