File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -23,3 +23,10 @@ docs/site/
23
23
# environment.
24
24
Manifest.toml
25
25
docs /src /assets /Project.toml
26
+
27
+ .vscode
28
+ TEST1.jl
29
+ TEST2.jl
30
+ TEST3.jl
31
+ trustRegion copy.jl
32
+ trustRegionHOLDER.jl
Original file line number Diff line number Diff line change @@ -309,8 +309,8 @@ function trust_region_step!(cache::TrustRegionCache)
309
309
if r > alg. step_threshold
310
310
311
311
# Take the step.
312
- cache . u = copy (u_tmp )
313
- cache . fu = copy (fu_new)
312
+ take_step! (cache )
313
+
314
314
cache. loss = cache. loss_new
315
315
316
316
# Update the trust region radius.
@@ -356,6 +356,16 @@ function dogleg!(cache::TrustRegionCache)
356
356
cache. step_size = δsd + τ * N_sd
357
357
end
358
358
359
+ function take_step! (cache:: TrustRegionCache{true} )
360
+ cache. u = copy (cache. u_tmp)
361
+ cache. fu = copy (cache. fu_new)
362
+ end
363
+
364
+ function take_step! (cache:: TrustRegionCache{false} )
365
+ cache. u = cache. u_tmp
366
+ cache. fu = cache. fu_new
367
+ end
368
+
359
369
function SciMLBase. solve! (cache:: TrustRegionCache )
360
370
while ! cache. force_stop && cache. iter < cache. maxiters &&
361
371
cache. shrink_counter < cache. alg. max_shrink_times
You can’t perform that action at this time.
0 commit comments