@@ -3,11 +3,6 @@ function SciMLBase.solve(prob::NonlinearProblem,
3
3
kwargs... )
4
4
solver = init (prob, alg, args... ; kwargs... )
5
5
sol = solve! (solver)
6
- if typeof (sol) <: NewtonSolution
7
- SciMLBase. build_solution (prob, alg, getsolution (sol), sol. resid;retcode= Symbol (sol. retcode))
8
- else
9
- SciMLBase. build_solution (prob, alg, get_solution (sol),sol. resid;retcode= Symbol (sol. retcode),left = sol. left,right = sol. right)
10
- end
11
6
end
12
7
13
8
function SciMLBase. init (prob:: NonlinearProblem{uType, iip} , alg:: AbstractBracketingAlgorithm , args... ;
@@ -34,7 +29,7 @@ function SciMLBase.init(prob::NonlinearProblem{uType, iip}, alg::AbstractBracket
34
29
fl = f (left, p)
35
30
fr = f (right, p)
36
31
cache = alg_cache (alg, left, right,p, Val (iip))
37
- return BracketingImmutableSolver (1 , f, alg, left, right, fl, fr, p, false , maxiters, DEFAULT, cache, iip)
32
+ return BracketingImmutableSolver (1 , f, alg, left, right, fl, fr, p, false , maxiters, DEFAULT, cache, iip,prob )
38
33
end
39
34
40
35
function SciMLBase. init (prob:: NonlinearProblem{uType, iip} , alg:: AbstractNewtonAlgorithm , args... ;
@@ -59,7 +54,7 @@ function SciMLBase.init(prob::NonlinearProblem{uType, iip}, alg::AbstractNewtonA
59
54
fu = f (u, p)
60
55
end
61
56
cache = alg_cache (alg, f, u, p, Val (iip))
62
- return NewtonImmutableSolver (1 , f, alg, u, fu, p, false , maxiters, internalnorm, DEFAULT, tol, cache, iip)
57
+ return NewtonImmutableSolver (1 , f, alg, u, fu, p, false , maxiters, internalnorm, DEFAULT, tol, cache, iip, prob )
63
58
end
64
59
65
60
function SciMLBase. solve! (solver:: AbstractImmutableNonlinearSolver )
@@ -72,7 +67,11 @@ function SciMLBase.solve!(solver::AbstractImmutableNonlinearSolver)
72
67
@set! solver. retcode = MAXITERS_EXCEED
73
68
end
74
69
sol = get_solution (solver)
75
- return sol
70
+ if typeof (sol) <: NewtonSolution
71
+ SciMLBase. build_solution (solver. prob, solver. alg, getsolution (sol), sol. resid;retcode= Symbol (sol. retcode))
72
+ else
73
+ SciMLBase. build_solution (solver. prob, solver. alg, getsolution (sol),sol. resid;retcode= Symbol (sol. retcode),left = sol. left,right = sol. right)
74
+ end
76
75
end
77
76
78
77
"""
0 commit comments