Skip to content

Commit 41cd0ca

Browse files
fixes #91
1 parent aaee38b commit 41cd0ca

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

docs/src/basics/problem.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
1-
# Problem interface
1+
# Problem Interface
2+
3+
This page defines the common problem interface. There are certain rules that
4+
can be applied to any function definition, and this page defines those behaviors.
5+
6+
## In-place vs Out-of-Place Function Definition Forms
7+
8+
Every problem definition has an in-place and out-of-place form, commonly referred
9+
throughout DiffEq as IIP (`isinplace`) and OOP (out of place). The in-place form
10+
is a mutating form. For example, on ODEs, we have that `f!(du,u,p,t)` is the
11+
in-place form which, as its output, mutates `du`. Whatever is returned is simply
12+
ignored. Similarly, for OOP we have the form `du=f(u,p,t)` which uses the return.
13+
14+
Each of the problem types have that the first argument is the option mutating
15+
argument. The DiffEqBase system will automatically determine the functional
16+
form and place a specifier `isinplace` on the function to carry as type information
17+
whether the function defined for this `DEProblem` is in-place. However, every
18+
constructor allows for manually specifying the in-placeness of the function.
19+
For example, this can be done at the problem level like:
20+
21+
```julia
22+
ODEProblem{true}(f,u0,tspan,p)
23+
```
24+
25+
which declares that `isinplace=true`. Similarly this can be done at the
26+
DEFunction level. For example:
27+
28+
```julia
29+
ODEFunction{true}(f,jac=myjac)
30+
```
31+
32+
## Type Specifications
33+
34+
Throughout DifferentialEquations.jl, the types that are given in a problem are
35+
the types used for the solution. If an initial value `u0` is needed for a problem,
36+
then the state variable `u` will match the type of that `u0`. Similarly, if
37+
time exists in a problem the type for `t` will be derived from the types of the
38+
`tspan`. Parameters `p` can be any type and the type will be matching how it's
39+
defined in the problem.
40+
41+
For internal matrices, such as Jacobians and Brownian caches, these also match
42+
the type specified by the user. `jac_prototype` and `rand_prototype` can thus
43+
be any Julia matrix type which is compatible with the operations that will be
44+
performed.
245

346
## Functional and Condensed Problem Inputs
447

0 commit comments

Comments
 (0)