@@ -948,7 +948,8 @@ dt: the time step
948
948
949
949
```julia
950
950
ImplicitDiscreteFunction{iip,specialize}(f;
951
- analytic = __has_analytic(f) ? f.analytic : nothing)
951
+ analytic = __has_analytic(f) ? f.analytic : nothing,
952
+ resid_prototype = __has_resid_prototype(f) ? f.resid_prototype : nothing)
952
953
```
953
954
954
955
Note that only the function `f` itself is required. This function should
@@ -973,12 +974,13 @@ For more details on this argument, see the ODEFunction documentation.
973
974
974
975
The fields of the ImplicitDiscreteFunction type directly match the names of the inputs.
975
976
"""
976
- struct ImplicitDiscreteFunction{iip, specialize, F, Ta, O, SYS, ID} < :
977
+ struct ImplicitDiscreteFunction{iip, specialize, F, Ta, O, SYS, RP, ID} < :
977
978
AbstractDiscreteFunction{iip}
978
979
f:: F
979
980
analytic:: Ta
980
981
observed:: O
981
982
sys:: SYS
983
+ resid_prototype:: RP
982
984
initialization_data:: ID
983
985
end
984
986
@@ -3064,6 +3066,9 @@ function ImplicitDiscreteFunction{iip, specialize}(f;
3064
3066
observed = __has_observed (f) ?
3065
3067
f. observed :
3066
3068
DEFAULT_OBSERVED,
3069
+ resid_prototype = __has_resid_prototype (f) ?
3070
+ f. resid_prototype :
3071
+ nothing ,
3067
3072
sys = __has_sys (f) ? f. sys : nothing ,
3068
3073
initialization_data = __has_initialization_data (f) ? f. initialization_data :
3069
3074
nothing ) where {
@@ -3074,39 +3079,40 @@ function ImplicitDiscreteFunction{iip, specialize}(f;
3074
3079
sys = sys_or_symbolcache (sys, syms, paramsyms, indepsym)
3075
3080
3076
3081
if specialize === NoSpecialize
3077
- ImplicitDiscreteFunction {iip, specialize, Any, Any, Any, Any, Any} (_f,
3082
+ ImplicitDiscreteFunction {iip, specialize, Any, Any, Any, Any, Any, Any } (_f,
3078
3083
analytic,
3079
3084
observed,
3080
3085
sys,
3086
+ resid_prototype,
3081
3087
initialization_data)
3082
3088
else
3083
3089
ImplicitDiscreteFunction{
3084
- iip, specialize, typeof (_f), typeof (analytic), typeof (observed), typeof (sys),
3090
+ iip, specialize, typeof (_f), typeof (analytic), typeof (observed), typeof (sys), typeof (resid_prototype ),
3085
3091
typeof (initialization_data)}(
3086
- _f, analytic, observed, sys, initialization_data)
3092
+ _f, analytic, observed, sys, resid_prototype, initialization_data)
3087
3093
end
3088
3094
end
3089
3095
3090
3096
function ImplicitDiscreteFunction {iip} (f; kwargs... ) where {iip}
3091
3097
ImplicitDiscreteFunction {iip, FullSpecialize} (f; kwargs... )
3092
3098
end
3093
3099
ImplicitDiscreteFunction {iip} (f:: ImplicitDiscreteFunction ; kwargs... ) where {iip} = f
3094
- function ImplicitDiscreteFunction (f; kwargs... )
3095
- ImplicitDiscreteFunction {isinplace(f, 5), FullSpecialize} (f; kwargs... )
3100
+ function ImplicitDiscreteFunction (f; resid_prototype = __has_resid_prototype (f) ? f . resid_prototype : nothing , kwargs... )
3101
+ ImplicitDiscreteFunction {isinplace(f, 5), FullSpecialize} (f; resid_prototype, kwargs... )
3096
3102
end
3097
3103
ImplicitDiscreteFunction (f:: ImplicitDiscreteFunction ; kwargs... ) = f
3098
3104
3099
3105
function unwrapped_f (f:: ImplicitDiscreteFunction , newf = unwrapped_f (f. f))
3100
3106
specialize = specialization (f)
3101
3107
3102
3108
if specialize === NoSpecialize
3103
- ImplicitDiscreteFunction{isinplace (f, 6 ), specialize, Any, Any,
3104
- Any, Any, Any}(newf, f. analytic, f. observed, f. sys, f. initialization_data)
3109
+ ImplicitDiscreteFunction{isinplace (f, 5 ), specialize, Any , Any, Any,
3110
+ Any, Any, Any}(newf, f. analytic, f. observed, f. sys, f. resid_prototype, f . initialization_data)
3105
3111
else
3106
- ImplicitDiscreteFunction{isinplace (f, 6 ), specialize, typeof (newf),
3112
+ ImplicitDiscreteFunction{isinplace (f, 5 ), specialize, typeof (newf),
3107
3113
typeof (f. analytic),
3108
- typeof (f. observed), typeof (f. sys), typeof (f. initialization_data)}(newf,
3109
- f. analytic, f. observed, f. sys, f. initialization_data)
3114
+ typeof (f. observed), typeof (f. sys), typeof (resid_prototype), typeof ( f. initialization_data)}(newf,
3115
+ f. analytic, f. observed, f. sys, f. resid_prototype, f . initialization_data)
3110
3116
end
3111
3117
end
3112
3118
0 commit comments