Skip to content

Commit d5ed597

Browse files
committed
Add build_solution for Newton Raphson
1 parent 949d46e commit d5ed597

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/solve.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ function SciMLBase.solve(prob::NonlinearProblem,
33
kwargs...)
44
solver = init(prob, alg, args...; kwargs...)
55
sol = solve!(solver)
6-
return sol
6+
if typeof(sol) <: NewtonSolution
7+
resid = zero(prob.u0)
8+
if isinplace(prob)
9+
prob.f(resid,sol.u,prob.p)
10+
else
11+
resid = prob.f(sol.u,prob.p)
12+
end
13+
return SciMLBase.build_solution(prob, alg, sol.u, resid;retcode=:Success)
14+
end
715
end
816

917
function SciMLBase.init(prob::NonlinearProblem{uType, iip}, alg::AbstractBracketingAlgorithm, args...;

0 commit comments

Comments
 (0)