Skip to content

Commit 3cd28d0

Browse files
Add __init and __solve dispatches for AbstractSteadyStateProblem
This PR adds default algorithm dispatches for AbstractSteadyStateProblem to use the same defaults as NonlinearProblem. The implementation mirrors the existing NonlinearProblem dispatches to ensure consistent behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a29cada commit 3cd28d0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/default.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,34 @@ function SciMLBase.__solve(prob::NonlinearProblem, ::Nothing, args...; kwargs...
3737
)
3838
end
3939

40+
function SciMLBase.__init(prob::SciMLBase.AbstractSteadyStateProblem, ::Nothing, args...; kwargs...)
41+
must_use_jacobian = Val(SciMLBase.has_jac(prob.f))
42+
return SciMLBase.__init(
43+
prob,
44+
FastShortcutNonlinearPolyalg(
45+
eltype(prob.u0); must_use_jacobian, u0_len = length(prob.u0)
46+
),
47+
args...;
48+
kwargs...
49+
)
50+
end
51+
52+
function SciMLBase.__solve(prob::SciMLBase.AbstractSteadyStateProblem, ::Nothing, args...; kwargs...)
53+
must_use_jacobian = Val(SciMLBase.has_jac(prob.f))
54+
prefer_simplenonlinearsolve = Val(prob.u0 isa StaticArray)
55+
return SciMLBase.__solve(
56+
prob,
57+
FastShortcutNonlinearPolyalg(
58+
eltype(prob.u0);
59+
must_use_jacobian,
60+
prefer_simplenonlinearsolve,
61+
u0_len = length(prob.u0)
62+
),
63+
args...;
64+
kwargs...
65+
)
66+
end
67+
4068
function SciMLBase.__init(prob::NonlinearLeastSquaresProblem, ::Nothing, args...; kwargs...)
4169
return SciMLBase.__init(
4270
prob, FastShortcutNLLSPolyalg(eltype(prob.u0)), args...; kwargs...

0 commit comments

Comments
 (0)