-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SciML.build_solution #28
Changes from 1 commit
949d46e
d5ed597
df1fd74
99ebebc
17898cf
254ce8b
4119a8e
973d041
f081339
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,8 @@ function SciMLBase.solve(prob::NonlinearProblem, | |
alg::AbstractNonlinearSolveAlgorithm, args...; | ||
kwargs...) | ||
solver = init(prob, alg, args...; kwargs...) | ||
sol = solve!(solver) | ||
sol, resid = solve!(solver) | ||
if typeof(sol) <: NewtonSolution | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this branching needed? It makes the solution type unstable and break non-Newton solvers. We can just assume that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two types of solver, Newton solver and Bracketing methods, which outputs |
||
resid = zero(prob.u0) | ||
if isinplace(prob) | ||
prob.f(resid,sol.u,prob.p) | ||
else | ||
resid = prob.f(sol.u,prob.p) | ||
end | ||
return SciMLBase.build_solution(prob, alg, sol.u, resid;retcode=:Success) | ||
end | ||
end | ||
|
@@ -76,7 +70,7 @@ function SciMLBase.solve!(solver::AbstractImmutableNonlinearSolver) | |
@set! solver.retcode = MAXITERS_EXCEED | ||
end | ||
sol = get_solution(solver) | ||
return sol | ||
return sol, solver.fu | ||
end | ||
|
||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solve!
has a standard interface that shouldn't be broken. We should just stick theresid
in thesol
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will update the
sol
struct withresid
.