|
1 |
| -function solve(prob::NonlinearProblem{<:Number}, alg::NewtonRaphson, args...; xatol = nothing, xrtol = nothing, maxiters = 1000, kwargs...) |
| 1 | +function SciMLBase.solve(prob::NonlinearProblem{<:Number}, alg::NewtonRaphson, args...; xatol = nothing, xrtol = nothing, maxiters = 1000, kwargs...) |
2 | 2 | f = Base.Fix2(prob.f, prob.p)
|
3 | 3 | x = float(prob.u0)
|
4 | 4 | T = typeof(x)
|
@@ -48,28 +48,28 @@ function scalar_nlsolve_ad(prob, alg, args...; kwargs...)
|
48 | 48 | return sol, partials
|
49 | 49 | end
|
50 | 50 |
|
51 |
| -function solve(prob::NonlinearProblem{<:Number, iip, <:Dual{T,V,P}}, alg::NewtonRaphson, args...; kwargs...) where {iip, T, V, P} |
| 51 | +function SciMLBase.solve(prob::NonlinearProblem{<:Number, iip, <:Dual{T,V,P}}, alg::NewtonRaphson, args...; kwargs...) where {iip, T, V, P} |
52 | 52 | sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
|
53 | 53 | return NewtonSolution(Dual{T,V,P}(sol.u, partials), sol.retcode)
|
54 | 54 | end
|
55 |
| -function solve(prob::NonlinearProblem{<:Number, iip, <:AbstractArray{<:Dual{T,V,P}}}, alg::NewtonRaphson, args...; kwargs...) where {iip, T, V, P} |
| 55 | +function SciMLBase.solve(prob::NonlinearProblem{<:Number, iip, <:AbstractArray{<:Dual{T,V,P}}}, alg::NewtonRaphson, args...; kwargs...) where {iip, T, V, P} |
56 | 56 | sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
|
57 | 57 | return NewtonSolution(Dual{T,V,P}(sol.u, partials), sol.retcode)
|
58 | 58 | end
|
59 | 59 |
|
60 | 60 | # avoid ambiguities
|
61 | 61 | for Alg in [Bisection]
|
62 |
| - @eval function solve(prob::NonlinearProblem{uType, iip, <:Dual{T,V,P}}, alg::$Alg, args...; kwargs...) where {uType, iip, T, V, P} |
| 62 | + @eval function SciMLBase.solve(prob::NonlinearProblem{uType, iip, <:Dual{T,V,P}}, alg::$Alg, args...; kwargs...) where {uType, iip, T, V, P} |
63 | 63 | sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
|
64 | 64 | return BracketingSolution(Dual{T,V,P}(sol.left, partials), Dual{T,V,P}(sol.right, partials), sol.retcode)
|
65 | 65 | end
|
66 |
| - @eval function solve(prob::NonlinearProblem{uType, iip, <:AbstractArray{<:Dual{T,V,P}}}, alg::$Alg, args...; kwargs...) where {uType, iip, T, V, P} |
| 66 | + @eval function SciMLBase.solve(prob::NonlinearProblem{uType, iip, <:AbstractArray{<:Dual{T,V,P}}}, alg::$Alg, args...; kwargs...) where {uType, iip, T, V, P} |
67 | 67 | sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
|
68 | 68 | return BracketingSolution(Dual{T,V,P}(sol.left, partials), Dual{T,V,P}(sol.right, partials), sol.retcode)
|
69 | 69 | end
|
70 | 70 | end
|
71 | 71 |
|
72 |
| -function solve(prob::NonlinearProblem, ::Bisection, args...; maxiters = 1000, kwargs...) |
| 72 | +function SciMLBase.solve(prob::NonlinearProblem, ::Bisection, args...; maxiters = 1000, kwargs...) |
73 | 73 | f = Base.Fix2(prob.f, prob.p)
|
74 | 74 | left, right = prob.u0
|
75 | 75 | fl, fr = f(left), f(right)
|
@@ -116,7 +116,7 @@ function solve(prob::NonlinearProblem, ::Bisection, args...; maxiters = 1000, kw
|
116 | 116 | return BracketingSolution(left, right, MAXITERS_EXCEED)
|
117 | 117 | end
|
118 | 118 |
|
119 |
| -function solve(prob::NonlinearProblem, ::Falsi, args...; maxiters = 1000, kwargs...) |
| 119 | +function SciMLBase.solve(prob::NonlinearProblem, ::Falsi, args...; maxiters = 1000, kwargs...) |
120 | 120 | f = Base.Fix2(prob.f, prob.p)
|
121 | 121 | left, right = prob.u0
|
122 | 122 | fl, fr = f(left), f(right)
|
|
0 commit comments