Developer API

ode_def_opts is the low-level implementation used by the public @ode_def, @ode_def_bare, and @ode_def_all macros. It is exported for compatibility, but package users should use those macros. It is intended for SciML package developers that need to define a macro with a different set of generated derivative functions; its input expression must follow the assignment-based ODE DSL accepted by @ode_def.

ParameterizedFunctions.ode_def_opts — Function
ode_def_opts(name::Symbol, opts::Dict{Symbol, Bool}, curmod,
    ex::Expr, params...; depvar = :t)

Build the expression emitted by the @ode_def family of macros.

This is a developer API for packages that implement an ODE-definition macro. Most users should call @ode_def, @ode_def_bare, or @ode_def_all instead. Callers must pass the assignment-based DSL expression accepted by those macros; this function returns an expression and does not evaluate the generated definition.

Arguments

  • name: name of the generated AbstractParameterizedFunction subtype.
  • opts: derivative-generation options. :build_tgrad, :build_jac, and :build_invW control generated functions. The compatibility keys :build_expjac, :build_invjac, :build_invW_t, :build_hes, :build_invhes, and :build_dpfuncs must also be present and have Bool values, but do not currently change the generated expression.
  • curmod: module in which functions named in ex are resolved.
  • ex: begin expression containing dstate = expression assignments.
  • params...: parameter symbols used in ex.

Keywords

  • depvar = :t: symbol used for the independent variable. It must not also name a dependent state.

Returns

An expression that defines a concrete AbstractParameterizedFunction subtype, generated callable methods, and a singleton instance.

Examples

opts = Dict{Symbol, Bool}(
    :build_tgrad => true, :build_jac => true, :build_expjac => false,
    :build_invjac => false, :build_invW => false, :build_invW_t => false,
    :build_hes => false, :build_invhes => false, :build_dpfuncs => true,
)
source