56
56
retcode:: ReturnCode.T
57
57
force_stop:: Bool
58
58
maxiters:: Int
59
+ internalnorm
59
60
end
60
61
61
62
function Base. show (
80
81
for (probType, pType) in ((:NonlinearProblem , :NLS ), (:NonlinearLeastSquaresProblem , :NLLS ))
81
82
algType = NonlinearSolvePolyAlgorithm{pType}
82
83
@eval begin
83
- function SciMLBase. __init (prob:: $probType , alg:: $algType{N} , args... ;
84
- maxtime = nothing , maxiters = 1000 , kwargs... ) where {N}
84
+ function SciMLBase. __init (
85
+ prob:: $probType , alg:: $algType{N} , args... ; maxtime = nothing ,
86
+ maxiters = 1000 , internalnorm = DEFAULT_NORM, kwargs... ) where {N}
85
87
return NonlinearSolvePolyAlgorithmCache {isinplace(prob), N, maxtime !== nothing} (
86
- map (solver -> SciMLBase. __init (prob, solver, args... ; maxtime, kwargs... ),
88
+ map (
89
+ solver -> SciMLBase. __init (
90
+ prob, solver, args... ; maxtime, internalnorm, kwargs... ),
87
91
alg. algs),
88
92
alg,
89
93
- 1 ,
@@ -93,7 +97,8 @@ for (probType, pType) in ((:NonlinearProblem, :NLS), (:NonlinearLeastSquaresProb
93
97
maxtime,
94
98
ReturnCode. Default,
95
99
false ,
96
- maxiters)
100
+ maxiters,
101
+ internalnorm)
97
102
end
98
103
end
99
104
end
134
139
push! (calls,
135
140
quote
136
141
fus = tuple ($ (Tuple (resids)... ))
137
- minfu, idx = __findmin (cache. caches[ 1 ] . internalnorm, fus)
138
- stats = cache. caches[idx]. stats
142
+ minfu, idx = __findmin (cache. internalnorm, fus)
143
+ stats = __compile_stats ( cache. caches[idx])
139
144
u = get_u (cache. caches[idx])
140
145
retcode = cache. caches[idx]. retcode
141
146
@@ -171,16 +176,15 @@ end
171
176
end )
172
177
end
173
178
174
- push! (calls,
175
- quote
176
- if ! (1 ≤ cache. current ≤ length (cache. caches))
177
- minfu, idx = __findmin (first (cache. caches). internalnorm, cache. caches)
178
- cache. best = idx
179
- cache. retcode = cache. caches[cache. best]. retcode
180
- cache. force_stop = true
181
- return
182
- end
183
- end )
179
+ push! (calls, quote
180
+ if ! (1 ≤ cache. current ≤ length (cache. caches))
181
+ minfu, idx = __findmin (cache. internalnorm, cache. caches)
182
+ cache. best = idx
183
+ cache. retcode = cache. caches[cache. best]. retcode
184
+ cache. force_stop = true
185
+ return
186
+ end
187
+ end )
184
188
185
189
return Expr (:block , calls... )
186
190
end
@@ -353,9 +357,11 @@ function FastShortcutNLLSPolyalg(::Type{T} = Float64; concrete_jac = nothing,
353
357
linsolve = nothing , precs = DEFAULT_PRECS, kwargs... ) where {T}
354
358
if __is_complex (T)
355
359
algs = (GaussNewton (; concrete_jac, linsolve, precs, kwargs... ),
360
+ LevenbergMarquardt (; linsolve, precs, disable_geodesic = Val (true ), kwargs... ),
356
361
LevenbergMarquardt (; linsolve, precs, kwargs... ))
357
362
else
358
363
algs = (GaussNewton (; concrete_jac, linsolve, precs, kwargs... ),
364
+ LevenbergMarquardt (; linsolve, precs, disable_geodesic = Val (true ), kwargs... ),
359
365
TrustRegion (; concrete_jac, linsolve, precs, kwargs... ),
360
366
GaussNewton (; concrete_jac, linsolve, precs,
361
367
linesearch = LineSearchesJL (; method = BackTracking ()), kwargs... ),
0 commit comments