@@ -2233,6 +2233,7 @@ BVPFunction{iip, specialize}(f, bc;
22332233 cost = __has_cost(f) ? f.cost : nothing,
22342234 equality = __has_equality(f) ? f.equality : nothing,
22352235 inequality = __has_inequality(f) ? f.inequality : nothing,
2236+ f_prototype = __has_f_prototype(f) ? f.f_prototype : nothing,
22362237 mass_matrix = __has_mass_matrix(f) ? f.mass_matrix : I,
22372238 analytic = __has_analytic(f) ? f.analytic : nothing,
22382239 tgrad= __has_tgrad(f) ? f.tgrad : nothing,
@@ -2265,6 +2266,9 @@ the usage of `f` and `bc`. These include:
22652266 of the BVP, which can be minimized by optimization solvers.
22662267- `equality(res, u, t)`: equality constraints functions for the BVP.
22672268- `inequality(res, u, t)`: inequality constraints functions for the BVP.
2269+ - `f_prototype`: a prototype matrix matching the type of the ODE/DAE variables in an optimal control
2270+ problem. For example, in the ODE/DAE that describe the dynamics of the optiml control problem,
2271+ `f_prototype` should match the type of ODE/DAE variables in `f`.
22682272- `mass_matrix`: the mass matrix `M` represented in the BVP function. Can be used
22692273 to determine that the equation is actually a BVP for differential algebraic equation (DAE)
22702274 if `M` is singular.
@@ -2319,14 +2323,15 @@ For more details on this argument, see the ODEFunction documentation.
23192323The fields of the BVPFunction type directly match the names of the inputs.
23202324"""
23212325struct BVPFunction{
2322- iip, specialize, twopoint, F, BF, C, EC, IC, TMM, Ta, Tt, TJ, BCTJ, JVP, VJP,
2326+ iip, specialize, twopoint, F, BF, C, EC, IC, FP, TMM, Ta, Tt, TJ, BCTJ, JVP, VJP,
23232327 JP, BCJP, BCRP, SP, TW, TWt, TPJ, O, TCV, BCTCV,
23242328 SYS, ID} <: AbstractBVPFunction{iip, twopoint}
23252329 f:: F
23262330 bc:: BF
23272331 cost:: C
23282332 equality:: EC
23292333 inequality:: IC
2334+ f_prototype:: FP
23302335 mass_matrix:: TMM
23312336 analytic:: Ta
23322337 tgrad:: Tt
@@ -4361,6 +4366,7 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
43614366 cost = __has_cost (f) ? f. cost : nothing ,
43624367 equality = __has_equality (f) ? f. equality : nothing ,
43634368 inequality = __has_inequality (f) ? f. inequality : nothing ,
4369+ f_prototype = __has_f_prototype (f) ? f. f_prototype : nothing ,
43644370 mass_matrix = __has_mass_matrix (f) ? f. mass_matrix : I,
43654371 analytic = __has_analytic (f) ? f. analytic : nothing ,
43664372 tgrad = __has_tgrad (f) ? f. tgrad : nothing ,
@@ -4503,25 +4509,25 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
45034509 sys = something (sys, SymbolCache (syms, paramsyms, indepsym))
45044510
45054511 if specialize === NoSpecialize
4506- BVPFunction{iip, specialize, twopoint, Any, Any, Any, Any, Any, Any, Any, Any,
4512+ BVPFunction{iip, specialize, twopoint, Any, Any, Any, Any, Any, Any, Any, Any, Any,
45074513 Any, Any, Any, Any, Any, Any, Any, Any, Any, Any,
45084514 Any,
45094515 Any, typeof (_colorvec), typeof (_bccolorvec), Any, Any}(
4510- _f, bc, cost, equality, inequality, mass_matrix,
4516+ _f, bc, cost, equality, inequality, f_prototype, mass_matrix,
45114517 analytic, tgrad, jac, bcjac, jvp, vjp, jac_prototype,
45124518 bcjac_prototype, bcresid_prototype,
45134519 sparsity, Wfact, Wfact_t, paramjac, observed,
45144520 _colorvec, _bccolorvec, sys, initialization_data)
45154521 else
45164522 BVPFunction{iip, specialize, twopoint, typeof (_f), typeof (bc), typeof (cost),
4517- typeof (equality), typeof (inequality),
4523+ typeof (equality), typeof (inequality), typeof (f_prototype),
45184524 typeof (mass_matrix), typeof (analytic), typeof (tgrad), typeof (jac),
45194525 typeof (bcjac), typeof (jvp), typeof (vjp), typeof (jac_prototype),
45204526 typeof (bcjac_prototype), typeof (bcresid_prototype), typeof (sparsity),
45214527 typeof (Wfact), typeof (Wfact_t), typeof (paramjac), typeof (observed),
45224528 typeof (_colorvec), typeof (_bccolorvec), typeof (sys),
45234529 typeof (initialization_data)}(
4524- _f, bc, cost, equality, inequality, mass_matrix, analytic,
4530+ _f, bc, cost, equality, inequality, f_prototype, mass_matrix, analytic,
45254531 tgrad, jac, bcjac, jvp, vjp,
45264532 jac_prototype, bcjac_prototype, bcresid_prototype, sparsity,
45274533 Wfact, Wfact_t, paramjac,
@@ -4981,6 +4987,7 @@ __has_denominator(f) = hasfield(typeof(f), :denominator)
49814987__has_cost (f) = hasfield (typeof (f), :cost )
49824988__has_equality (f) = hasfield (typeof (f), :equality )
49834989__has_inequality (f) = hasfield (typeof (f), :inequality )
4990+ __has_f_prototype (f) = hasfield (typeof (f), :f_prototype )
49844991
49854992# compatibility
49864993has_invW (f:: AbstractSciMLFunction ) = false
0 commit comments