@@ -152,14 +152,12 @@ function (f::ODEToExpr)(O::Operation)
152
152
end
153
153
(f:: ODEToExpr )(x) = convert (Expr, x)
154
154
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)
157
156
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))
159
158
end
160
159
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)
163
161
rhss = [deq. rhs for deq ∈ sys. eqs]
164
162
dvs′ = [clean (dv) for dv ∈ dvs]
165
163
ps′ = [clean (p) for p ∈ ps]
@@ -190,21 +188,14 @@ function calculate_factorized_W(sys::ODESystem, simplify=true)
190
188
(Wfact,Wfact_t)
191
189
end
192
190
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 )
195
192
(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 )
196
198
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
208
199
Wfact_func = build_function (Wfact , vs, ps, (:gam ,:t ), ODEToExpr (sys);constructor= constructor)
209
200
Wfact_t_func = build_function (Wfact_t, vs, ps, (:gam ,:t ), ODEToExpr (sys);constructor= constructor)
210
201
@@ -218,12 +209,12 @@ Create an `ODEFunction` from the [`ODESystem`](@ref). The arguments `dvs` and `p
218
209
are used to set the order of the dependent variable and parameter vectors,
219
210
respectively.
220
211
"""
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
224
215
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 ))
227
218
ODEFunction {iip} (eval (expr),jac= jac_expr,
228
219
Wfact = Wfact_expr, Wfact_t = Wfact_t_expr)
229
220
end
0 commit comments