Skip to contents

Entry points

Entry points. The first three share the code generator.
entry point problem numerical core article
cppODE() ODE \(\dot x = f(x, p, t)\) in-tree integrator, inst/include/cppde/ Stepping to Second derivatives
cvode() ODE \(\dot x = f(x, p, t)\) SUNDIALS CVODE/CVODES cvode() and the CVODES adjoint
cppFUN() algebraic \(y = g(x, p)\) none Derivative directions of cppFUN()
ptc() steady state \(f(x, p) = 0\), \(C x = b\) pseudo-transient continuation on a cppFUN() object Steady states by pseudo-transient continuation

cppODE() and cvode() take the same model arguments (rhs, events, rootfunc, fixed, forcings) and return the same object for solveODE() (comparison). cppFUN() derivatives are "forward" (second order with deriv2 = TRUE), "reverse" or "forward-reverse".

Order of the articles

  1. Code generation: expression graph and emitted C++ of all entry points.
  2. Stepping and error control: the four methods of cppODE(), error control, dense output.
  3. Forward sensitivities: dual numbers.
  4. Events, switches and saltation: sensitivities across resets, root events and switches.
  5. Reverse mode: the discrete adjoint: gradients at a cost independent of the parameter count.
  6. Events in reverse mode: adjoint of a jump, to second order.
  7. Grid and refinement of the sweep: the adjoint grid and refine.
  8. Second derivatives: forward over reverse: Hessian-vector products.
  9. cvode() and the CVODES adjoint: the SUNDIALS backend.
  10. Derivative directions of cppFUN(): observation maps and reparameterizations.
  11. Steady states by pseudo-transient continuation: ptc() under conservation laws, stability test.
  12. Method coefficients: appendix.

Batches of conditions: Batches of conditions. Benchmarks compares the integrators and the derivative modes.

Notation

Symbols shared by the methods articles; others are defined where they first appear.
symbol meaning
\(t\), \(t_0\), \(T\) time, initial time, last output time
\(x \in \mathbb{R}^{n_x}\) state; \(x_0 = x(t_0)\)
\(p \in \mathbb{R}^{n_p}\) parameters of the right-hand side
\(f(x, p, t)\) right-hand side, \(\dot x = f\)
\(J = \partial f/\partial x\) state Jacobian
\(y = g(x, p)\) observables, the prediction compared with data; the algebraic function of cppFUN()
\(\theta \in \mathbb{R}^{M}\) parameters of the derivatives, with \(x_0(\theta)\), \(p(\theta)\); \(\theta = (x_0, p)\), \(M = n_x + n_p\) under the identity tangent
\(\partial(x_0, p)/\partial\theta\) tangent of the inputs, argument tangent of solveODE()
\(S = \partial x/\partial\theta \in \mathbb{R}^{n_x \times M}\) sensitivity matrix
\(t_o\), \(o = 1, \dots, n_{\mathrm{obs}}\) output times, rows of the returned trajectory
\(w \in \mathbb{R}^{n_{\mathrm{obs}} \times n_x}\) cotangent of the outputs, row \(w_o\) at \(t_o\)
\(\lambda \in \mathbb{R}^{n_x}\) adjoint state
\(\bar\theta\), \(\bar x_0\), \(\bar p\) cotangent of the inputs, the gradient of \(\sum_o w_o^{\mathsf T} x(t_o)\)
\(\mathcal{J}(\theta)\) objective function of a fit, a scalar functional of the outputs; \(\bar\theta = \nabla_\theta \mathcal{J}\) for \(w_o = \partial\mathcal{J}/\partial x(t_o)\)
\(t_n\), \(x_n\) step points and computed states
\(h_n = t_{n+1} - t_n\) step size
\(q\), \(q_{\max}\) order, maximum order
\(e_{n+1}\) local error estimate of the step from \(t_n\)
\(\lVert\cdot\rVert_{\mathrm{WRMS}}\) weighted root-mean-square norm, Stepping (8)
\(W\) iteration matrix of an implicit step, a shift of \(-J\)
\(h_e(x, t, \theta)\) root function of an event or switch
\(t_e(\theta)\) firing time of a time-triggered event, an expression
\(t^{*}\), \(t_*^{(0)}\) firing time; the value of \(t^{*}\) without derivatives, the grid time
\(\delta t^{*} = t^{*} - t_*^{(0)}\) firing-time residual: zero in value, holds the derivatives of \(t^{*}\)
\(\dot h_e = \partial h_e/\partial t + \nabla_x h_e \cdot f\) rate of the root function along the trajectory
\(R(x, t)\) reset map of an event
\(x^{-}\), \(x^{+}\); \(f^{-}\), \(f^{+}\) state and right-hand side before and after an event