Skip to content

Commit 7f323fb

Browse files
committed
test: needs NonlinearSolve
1 parent 3b068c2 commit 7f323fb

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

lib/NonlinearSolveFirstOrder/test/least_squares_tests.jl

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,3 @@ end
5454
@test norm(sol.resid, 2) < 1e-6
5555
end
5656
end
57-
58-
@testitem "Correct Best Solution: #565" setup=[CoreNLLSTesting] tags=[:core] begin
59-
using StableRNGs
60-
61-
x = collect(0:0.1:10)
62-
63-
line_fct(x, p) = p[1] .+ p[2] .* x
64-
65-
y_line = line_fct(x, [1, 3])
66-
y_line_n = line_fct(x, [1, 3]) + randn(StableRNG(0), length(x))
67-
68-
res(β, (x, y)) = line_fct(x, β) .- y
69-
70-
prob = NonlinearLeastSquaresProblem(res, [1, 3], p = (x, y_line_n))
71-
sol1 = solve(prob; maxiters = 1000)
72-
73-
prob = NonlinearLeastSquaresProblem(res, [1, 5], p = (x, y_line_n))
74-
sol2 = solve(prob; maxiters = 1000)
75-
76-
@test sol1.u sol2.u
77-
end

test/issue_tests.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@testitem "Correct Best Solution: #565" tags=[:core] begin
2+
using NonlinearSolve, StableRNGs
3+
4+
x = collect(0:0.1:10)
5+
6+
line_fct(x, p) = p[1] .+ p[2] .* x
7+
8+
y_line = line_fct(x, [1, 3])
9+
y_line_n = line_fct(x, [1, 3]) + randn(StableRNG(0), length(x))
10+
11+
res(β, (x, y)) = line_fct(x, β) .- y
12+
13+
prob = NonlinearLeastSquaresProblem(res, [1, 3], p = (x, y_line_n))
14+
sol1 = solve(prob; maxiters = 1000)
15+
16+
prob = NonlinearLeastSquaresProblem(res, [1, 5], p = (x, y_line_n))
17+
sol2 = solve(prob; maxiters = 1000)
18+
19+
@test sol1.u sol2.u
20+
end

0 commit comments

Comments
 (0)