DiffEqBase.jl icon indicating copy to clipboard operation
DiffEqBase.jl copied to clipboard

Use `applicable`?

Open devmotion opened this issue 6 years ago • 1 comments

It seems as soon as the concrete values of u0, tspan, and p are known, we can infer whether the provided model is in in-place or out-of-place form (or if it's misspecified) in a straightforward way by checking

applicable(f, rate_prototype(u0, t0), u0, p, t0)

and

applicable(f, u0, p, t0)

where, e.g.,

rate_prototype(u0, t0) = @. u0 * $(inv(oneunit(t0)))

I'm not sure yet if that could be helpful in any way, but at least these checks seem a bit more natural than the current checks on the number of arguments. However, there's no way we can perform these "more sophisticated" checks when the DEFunction or DEProblem is defined initially, since at that time point the input arguments are not known or might not be concrete, respectively.

devmotion avatar Aug 26 '19 15:08 devmotion

Yeah, that might be a nicer way to do it.

ChrisRackauckas avatar Aug 28 '19 23:08 ChrisRackauckas