constructorof is overloaded for ODEFunction and the other one-function types but not for SplitFunction, DynamicalODEFunction, DynamicalDDEFunction, SplitSDEFunction or DynamicalSDEFunction, so @set and @reset fall back to a positional constructor those types don't have:
using SciMLBase, Accessors
f1(dv, v, u, p, t) = (dv .= -u; nothing)
f2(du, v, u, p, t) = (du .= v; nothing)
fn = DynamicalODEFunction(f1, f2; jac_prototype = zeros(2, 2))
@set fn.jac_prototype = zeros(Float32, 2, 2)
ERROR: MethodError: no method matching DynamicalODEFunction(::ODEFunction{true, SciMLBase.AutoSpecialize, typeof(f1), ...}, ::ODEFunction{true, ...}, ::UniformScaling{Bool}, ::Nothing, ...)
The practical fallout is in DiffEqBase: promote_f does exactly this @set on any jac_prototype <: AbstractArray, so solve and init throw on every SecondOrderODEProblem or DynamicalODEProblem whose function carries a jac_prototype, dense or sparse, before any solver sees it (DiffEqBase 7.21.2, SciMLBase 3.56.1).
Writing a test for this also turned up that DynamicalDDEFunction(f1, f2) can't be constructed at all: the keyword constructor's initialization_data default reads f instead of f1, and its return type leaves out the specialize parameter, so it throws an UndefVarError, and a MethodError once that's fixed.
constructorofis overloaded forODEFunctionand the other one-function types but not forSplitFunction,DynamicalODEFunction,DynamicalDDEFunction,SplitSDEFunctionorDynamicalSDEFunction, so@setand@resetfall back to a positional constructor those types don't have:The practical fallout is in DiffEqBase:
promote_fdoes exactly this@seton anyjac_prototype <: AbstractArray, sosolveandinitthrow on everySecondOrderODEProblemorDynamicalODEProblemwhose function carries ajac_prototype, dense or sparse, before any solver sees it (DiffEqBase 7.21.2, SciMLBase 3.56.1).Writing a test for this also turned up that
DynamicalDDEFunction(f1, f2)can't be constructed at all: the keyword constructor'sinitialization_datadefault readsfinstead off1, and its return type leaves out thespecializeparameter, so it throws anUndefVarError, and aMethodErroronce that's fixed.