Skip to content

Commit

Permalink
Improve nonlinear solver tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Jul 10, 2024
1 parent 4147648 commit 24a3e0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/nonlinear_solvers_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ test_solver = NonlinearSolverTest{Float64}()


function F!(f, x)
f .= x.^2
f .= tan.(x)
end

function J!(g, x)
g .= 0
for i in eachindex(x)
g[i,i] = 2x[i]
g[i,i] = sec(x[i])^2
end
end

Expand Down Expand Up @@ -50,15 +50,15 @@ for (Solver, kwarguments) in (
solve!(x, F!, nl)
# println(status(nl))
for _x in x
@test _x 0 atol=1E-7
@test _x 0 atol = eps(T)
end

x = ones(T, n)
nl = Solver(x, y; J! = J!, kwarguments...)
solve!(x, F!, J!, nl)
# println(status(nl))
for _x in x
@test _x 0 atol=1E-7
@test _x 0 atol = eps(T)
end
end
end

0 comments on commit 24a3e0b

Please sign in to comment.