Skip to content

Commit c6e14c0

Browse files
committed
Reformat docstring
1 parent a7d2eb0 commit c6e14c0

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

src/systems/diffeqs/odesystem.jl

+36-22
Original file line numberDiff line numberDiff line change
@@ -409,34 +409,48 @@ end
409409
ODESystem(eq::Equation, args...; kwargs...) = ODESystem([eq], args...; kwargs...)
410410

411411
"""
412-
$(SIGNATURES)
412+
build_explicit_observed_function(sys, ts; kwargs...) -> Function(s)
413+
414+
Generates a function that computes the observed value(s) `ts` in the system `sys`, while making the assumption that there are no cycles in the equations.
415+
416+
## Arguments
417+
- `sys`: The system for which to generate the function
418+
- `ts`: The symbolic observed values whose value should be computed
419+
420+
## Keywords
421+
- `return_inplace = false`: If true and the observed value is a vector, then return both the in place and out of place methods.
422+
- `expression = false`: Generates a Julia `Expr`` computing the observed value if `expression` is true
423+
- `eval_expression = false`: If true and `expression = false`, evaluates the returned function in the module `eval_module`
424+
- `output_type = Array` the type of the array generated by a out-of-place vector-valued function
425+
- `param_only = false` if true, only allow the generated function to access system parameters
426+
- `inputs = nothing` additinoal symbolic variables that should be provided to the generated function
427+
- `checkbounds = true` checks bounds if true when destructuring parameters
428+
- `op = Operator` sets the recursion terminator for the walk done by `vars` to identify the variables that appear in `ts`. See the documentation for `vars` for more detail.
429+
- `throw = true` if true, throw an error when generating a function for `ts` that reference variables that do not exist.
430+
- `mkarray`; only used if the output is an array (that is, `!isscalar(ts)`). Called as `mkarray(ts, output_type)` where `ts` are the expressions to put in
431+
the array and `output_type` is the argument of the same name passed to build_explicit_observed_function.
432+
433+
## Returns
413434
414-
Generates a function that computes the observed value(s) `ts` in the system `sys` assuming that there are no cycles in the equations.
415-
416435
The return value will be either:
417-
* a single function if the input is a scalar or if the input is a Vector but `return_inplace` is false
418-
* the out of place and in-place functions `(ip, oop)` if `return_inplace` is true and the input is a `Vector`
436+
* a single function `f_oop` if the input is a scalar or if the input is a Vector but `return_inplace` is false
437+
* the out of place and in-place functions `(f_ip, f_oop)` if `return_inplace` is true and the input is a `Vector`
419438
420-
The function(s) will be:
439+
The function(s) `f_oop` (and potentially `f_ip`) will be:
421440
* `RuntimeGeneratedFunction`s by default,
422441
* A Julia `Expr` if `expression` is true,
423-
* A directly evaluated Julia function in the module `eval_module` if `eval_expression` is true
442+
* A directly evaluated Julia function in the module `eval_module` if `eval_expression` is true and `expression` is false.
424443
425444
The signatures will be of the form `g(...)` with arguments:
426-
* `output` for in-place functions
427-
* `unknowns` if `params_only` is `false`
428-
* `inputs` if `inputs` is an array of symbolic inputs that should be available in `ts`
429-
* `p...` unconditionally; note that in the case of `MTKParameters` more than one parameters argument may be present, so it must be splatted
430-
* `t` if the system is time-dependent; for example `NonlinearSystem` will not have `t`
431-
For example, a function `g(op, unknowns, p, inputs, t)` will be the in-place function generated if `return_inplace` is true, `ts` is a vector, an array of inputs `inputs` is given, and `params_only` is false for a time-dependent system.
432-
433-
Options not otherwise specified are:
434-
* `output_type = Array` the type of the array generated by the out-of-place vector-valued function
435-
* `checkbounds = true` checks bounds if true when destructuring parameters
436-
* `op = Operator` sets the recursion terminator for the walk done by `vars` to identify the variables that appear in `ts`. See the documentation for `vars` for more detail.
437-
* `throw = true` if true, throw an error when generating a function for `ts` that reference variables that do not exist
438-
* `drop_expr` is deprecated.
439-
* `mkarray`; only used if the output is an array (that is, `!isscalar(ts)`). Called as `mkarray(ts, output_type)` where `ts` are the expressions to put in the array and `output_type` is the argument of the same name passed to build_explicit_observed_function.
445+
446+
- `output` for in-place functions
447+
- `unknowns` if `param_only` is `false`
448+
- `inputs` if `inputs` is an array of symbolic inputs that should be available in `ts`
449+
- `p...` unconditionally; note that in the case of `MTKParameters` more than one parameters argument may be present, so it must be splatted
450+
- `t` if the system is time-dependent; for example `NonlinearSystem` will not have `t`
451+
452+
For example, a function `g(op, unknowns, p..., inputs, t)` will be the in-place function generated if `return_inplace` is true, `ts` is a vector,
453+
an array of inputs `inputs` is given, and `param_only` is false for a time-dependent system.
440454
"""
441455
function build_explicit_observed_function(sys, ts;
442456
inputs = nothing,
@@ -445,7 +459,7 @@ function build_explicit_observed_function(sys, ts;
445459
eval_module = @__MODULE__,
446460
output_type = Array,
447461
checkbounds = true,
448-
ps = parameters(sys),
462+
ps = parameters(sys),
449463
return_inplace = false,
450464
param_only = false,
451465
op = Operator,

0 commit comments

Comments
 (0)