Prev Next

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Reverse Mode AD

Syntax
xq = f.reverse(qyq)

f
This is either a d_fun or a_fun function object and is effectively const. (Some details that are not visible to the user may change.)

Notation

f(x)
We use the notation @(@ f: \B{R}^n \rightarrow \B{R}^m @)@ for the function corresponding to f . Note that n is the size of ax and m is the size of ay in to the constructor for f .

X(t), S
This is the same function as X(t) in the previous call to f.forward . We use @(@ S \in \B{R}^{n \times q} @)@ to denote the Taylor coefficients of @(@ X(t) @)@.

Y(t), T
This is the same function as Y(t) in the previous call to f.forward . We use @(@ T \in \B{R}^{m \times q} @)@ to denote the Taylor coefficients of @(@ Y(t) @)@. We also use the notation @(@ T(S) @)@ to express the fact that the Taylor coefficients for @(@ Y(t) @)@ are a function of the Taylor coefficients of @(@ X(t) @)@.

G(T)
We use the notation @(@ G : \B{R}^{m \times p} \rightarrow \B{R} @)@ for a function that the calling routine chooses.

q
This argument has prototype
     int 
q
and is positive. It is the number of the Taylor coefficient (for each variable) that we are computing the derivative with respect to. It must be greater than zero, and less than or equal the number of Taylor coefficient stored in f ; i.e., f.size_order() .

yq
If f is a d_fun or a_fun, this argument has prototype
     const vec_double&   
yq
     const vec_a_double& 
yq
and its size must be m*q . For 0 <= i < m and 0 <= k < q , yqi * q + k ] is the partial derivative of @(@ G(T) @)@ with respect to the k-th order Taylor coefficient for the i-th component function; i.e., the partial derivative of @(@ G(T) @)@ w.r.t. @(@ Y_i^{(k)} (t) / k ! @)@.

xq
If f is a d_fun or a_fun, the result has prototype
     const vec_double&   
xq
     const vec_a_double& 
xq
respectively and its size is n*q . For 0 <= j < n and 0 <= k < q , yqj * q + k ] is the partial derivative of @(@ G(T(S)) @)@ with respect to the k-th order Taylor coefficient for the j-th component function; i.e., the partial derivative of @(@ G(T(S)) @)@ w.r.t. @(@ S_j^{(k)} (t) / k ! @)@.

Example
fun_reverse_xam.cpp
Input File: lib/cplusplus/fun.cpp