NonlinearSolve.jl icon indicating copy to clipboard operation
NonlinearSolve.jl copied to clipboard

Test of low overhead mode

Open ChrisRackauckas opened this issue 3 years ago • 0 comments

using NonlinearSolve
N = 100_000;
levels = 1.5 .* rand(N);
out = zeros(N);
myfun(x, lv) = x * sin(x) - lv

function f(out, levels, u0)
    for i in 1:N
        out[i] = solve(NonlinearProblem{false}(NonlinearFunction{false}(myfun),
                u0, levels[i]), Falsi()).u
    end
end

function f2(out, levels, u0)
    for i in 1:N
        out[i] = solve(NonlinearProblem{false}(NonlinearFunction{false}(myfun),
                u0, levels[i]), NewtonRaphson()).u
    end
end
@time f(out, levels, (0.0, 2.0))
@time f2(out, levels, 1.0)

ChrisRackauckas avatar Sep 15 '22 11:09 ChrisRackauckas