Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit df0f2f6

Browse files
Complete the name change
1 parent 26f7d86 commit df0f2f6

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/basictests.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ if VERSION >= v"1.7"
5252
@test (@ballocated benchmark_scalar(sf, csu0)) == 0
5353
end
5454

55-
# TrustRegion
55+
# SimpleTrustRegion
5656
function benchmark_scalar(f, u0)
5757
probN = NonlinearProblem{false}(f, u0)
58-
sol = (solve(probN, TrustRegion(10.0)))
58+
sol = (solve(probN, SimpleTrustRegion(10.0)))
5959
end
6060

6161
sol = benchmark_scalar(sf, csu0)
@@ -69,7 +69,7 @@ using ForwardDiff
6969
f, u0 = (u, p) -> u .* u .- p, @SVector[1.0, 1.0]
7070

7171
for alg in [SimpleNewtonRaphson(), Broyden(), Klement(),
72-
TrustRegion(10.0)]
72+
SimpleTrustRegion(10.0)]
7373
g = function (p)
7474
probN = NonlinearProblem{false}(f, csu0, p)
7575
sol = solve(probN, alg, abstol = 1e-9)
@@ -85,7 +85,7 @@ end
8585
# Scalar
8686
f, u0 = (u, p) -> u * u - p, 1.0
8787
for alg in [SimpleNewtonRaphson(), Broyden(), Klement(),
88-
TrustRegion(10.0)]
88+
SimpleTrustRegion(10.0)]
8989
g = function (p)
9090
probN = NonlinearProblem{false}(f, oftype(p, u0), p)
9191
sol = solve(probN, alg)
@@ -127,7 +127,7 @@ for alg in [Bisection(), Falsi()]
127127
end
128128

129129
for alg in [SimpleNewtonRaphson(), Broyden(), Klement(),
130-
TrustRegion(10.0)]
130+
SimpleTrustRegion(10.0)]
131131
global g, p
132132
g = function (p)
133133
probN = NonlinearProblem{false}(f, 0.5, p)
@@ -144,8 +144,8 @@ probN = NonlinearProblem(f, u0)
144144

145145
@test solve(probN, SimpleNewtonRaphson()).u[end] sqrt(2.0)
146146
@test solve(probN, SimpleNewtonRaphson(; autodiff = false)).u[end] sqrt(2.0)
147-
@test solve(probN, TrustRegion(10.0)).u[end] sqrt(2.0)
148-
@test solve(probN, TrustRegion(10.0; autodiff = false)).u[end] sqrt(2.0)
147+
@test solve(probN, SimpleTrustRegion(10.0)).u[end] sqrt(2.0)
148+
@test solve(probN, SimpleTrustRegion(10.0; autodiff = false)).u[end] sqrt(2.0)
149149
@test solve(probN, Broyden()).u[end] sqrt(2.0)
150150
@test solve(probN, Klement()).u[end] sqrt(2.0)
151151

@@ -159,9 +159,9 @@ for u0 in [1.0, [1, 1.0]]
159159
@test solve(probN, SimpleNewtonRaphson()).u sol
160160
@test solve(probN, SimpleNewtonRaphson(; autodiff = false)).u sol
161161

162-
@test solve(probN, TrustRegion(10.0)).u sol
163-
@test solve(probN, TrustRegion(10.0)).u sol
164-
@test solve(probN, TrustRegion(10.0; autodiff = false)).u sol
162+
@test solve(probN, SimpleTrustRegion(10.0)).u sol
163+
@test solve(probN, SimpleTrustRegion(10.0)).u sol
164+
@test solve(probN, SimpleTrustRegion(10.0; autodiff = false)).u sol
165165

166166
@test solve(probN, Broyden()).u sol
167167

@@ -205,7 +205,7 @@ sol = solve(probB, Bisection(; exact_left = true, exact_right = true); immutable
205205
@test f(sol.right, nothing) >= 0.0
206206
@test f(prevfloat(sol.right), nothing) <= 0.0
207207

208-
# Test that `TrustRegion` passes a test that `SimpleNewtonRaphson` fails on.
208+
# Test that `SimpleTrustRegion` passes a test that `SimpleNewtonRaphson` fails on.
209209
u0 = [-10.0, -1.0, 1.0, 2.0, 3.0, 4.0, 10.0]
210210
global g, f
211211
f = (u, p) -> 0.010000000000000002 .+
@@ -219,15 +219,15 @@ f = (u, p) -> 0.010000000000000002 .+
219219
.-p
220220
g = function (p)
221221
probN = NonlinearProblem{false}(f, u0, p)
222-
sol = solve(probN, TrustRegion(100.0))
222+
sol = solve(probN, SimpleTrustRegion(100.0))
223223
return sol.u
224224
end
225225
p = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
226226
u = g(p)
227227
f(u, p)
228228
@test all(f(u, p) .< 1e-10)
229229

230-
# Test kwars in `TrustRegion`
230+
# Test kwars in `SimpleTrustRegion`
231231
max_trust_radius = [10.0, 100.0, 1000.0]
232232
initial_trust_radius = [10.0, 1.0, 0.1]
233233
step_threshold = [0.0, 0.01, 0.25]
@@ -242,7 +242,7 @@ list_of_options = zip(max_trust_radius, initial_trust_radius, step_threshold,
242242
expand_factor, max_shrink_times)
243243
for options in list_of_options
244244
local probN, sol, alg
245-
alg = TrustRegion(options[1];
245+
alg = SimpleTrustRegion(options[1];
246246
initial_trust_radius = options[2],
247247
step_threshold = options[3],
248248
shrink_threshold = options[4],

0 commit comments

Comments
 (0)