@@ -152,14 +152,12 @@ function (f::ODEToExpr)(O::Operation)
152152end
153153(f:: ODEToExpr )(x) = convert (Expr, x)
154154
155- function generate_jacobian (sys:: ODESystem ; version:: FunctionVersion = nothing )
156- version != nothing && @warn (" version is deprecated. Both dispatches are now constructed in the same function by defualt." )
155+ function generate_jacobian (sys:: ODESystem , dvs = sys. dvs, ps = sys. ps)
157156 jac = calculate_jacobian (sys)
158- return build_function (jac, sys . dvs, sys . ps, (sys. iv. name,), ODEToExpr (sys))
157+ return build_function (jac, dvs, ps, (sys. iv. name,), ODEToExpr (sys))
159158end
160159
161- function generate_function (sys:: ODESystem , dvs, ps; version:: FunctionVersion = nothing )
162- version != nothing && @warn (" version is deprecated. Both dispatches are now constructed in the same function by defualt." )
160+ function generate_function (sys:: ODESystem , dvs = sys. dvs, ps = sys. ps)
163161 rhss = [deq. rhs for deq ∈ sys. eqs]
164162 dvs′ = [clean (dv) for dv ∈ dvs]
165163 ps′ = [clean (p) for p ∈ ps]
@@ -190,21 +188,14 @@ function calculate_factorized_W(sys::ODESystem, simplify=true)
190188 (Wfact,Wfact_t)
191189end
192190
193- function generate_factorized_W (sys:: ODESystem , simplify= true ; version:: FunctionVersion = nothing )
194- version != nothing && @warn (" version is deprecated. Both dispatches are now constructed in the same function by defualt." )
191+ function generate_factorized_W (sys:: ODESystem , vs = sys. dvs, ps = sys. ps, simplify= true )
195192 (Wfact,Wfact_t) = calculate_factorized_W (sys,simplify)
193+ siz = size (Wfact)
194+ constructor = :(x -> begin
195+ A = SMatrix {$siz...} (x)
196+ StaticArrays. LU (LowerTriangular ( SMatrix {$siz...} (UnitLowerTriangular (A)) ), UpperTriangular (A), SVector (ntuple (n-> n, max ($ siz... ))))
197+ end )
196198
197- if version === SArrayFunction
198- siz = size (Wfact)
199- constructor = :(x -> begin
200- A = SMatrix {$siz...} (x)
201- StaticArrays. LU (LowerTriangular ( SMatrix {$siz...} (UnitLowerTriangular (A)) ), UpperTriangular (A), SVector (ntuple (n-> n, max ($ siz... ))))
202- end )
203- else
204- constructor = nothing
205- end
206-
207- vs, ps = sys. dvs, sys. ps
208199 Wfact_func = build_function (Wfact , vs, ps, (:gam ,:t ), ODEToExpr (sys);constructor= constructor)
209200 Wfact_t_func = build_function (Wfact_t, vs, ps, (:gam ,:t ), ODEToExpr (sys);constructor= constructor)
210201
@@ -218,12 +209,12 @@ Create an `ODEFunction` from the [`ODESystem`](@ref). The arguments `dvs` and `p
218209are used to set the order of the dependent variable and parameter vectors,
219210respectively.
220211"""
221- function DiffEqBase. ODEFunction {iip} (sys:: ODESystem , dvs, ps; version :: FunctionVersion = nothing ,
222- jac = false , Wfact = false ) where iip
223- version != nothing && @warn ( " version is deprecated. Both dispatches are now constructed in the same function by defualt. " )
212+ function DiffEqBase. ODEFunction {iip} (sys:: ODESystem , dvs, ps;
213+ version = nothing ,
214+ jac = false , Wfact = false ) where iip
224215 expr = eval (generate_function (sys, dvs, ps))
225- jac_expr = jac ? nothing : eval (generate_jacobian (sys))
226- Wfact_expr,Wfact_t_expr = Wfact ? (nothing ,nothing ) : eval .(generate_factorized_W (sys))
216+ jac_expr = jac ? nothing : eval (generate_jacobian (sys, dvs, ps ))
217+ Wfact_expr,Wfact_t_expr = Wfact ? (nothing ,nothing ) : eval .(generate_factorized_W (sys, dvs, ps ))
227218 ODEFunction {iip} (eval (expr),jac= jac_expr,
228219 Wfact = Wfact_expr, Wfact_t = Wfact_t_expr)
229220end
0 commit comments