CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
template<typename Base >
template<typename VectorBase >
VectorBase CppAD::ADFun< Base >::Reverse ( size_t  q,
const VectorBase &  w 
)

reverse mode sweep

Use reverse mode to compute derivative of forward mode Taylor coefficients.

The function $ X : {\bf R} \times {\bf R}^{n \times q} \rightarrow {\bf R} $ is defined by

\[ X(t , u) = \sum_{k=0}^{q-1} u^{(k)} t^k \]

The function $ Y : {\bf R} \times {\bf R}^{n \times q} \rightarrow {\bf R} $ is defined by

\[ Y(t , u) = F[ X(t, u) ] \]

The function $ W : {\bf R}^{n \times q} \rightarrow {\bf R} $ is defined by

\[ W(u) = \sum_{k=0}^{q-1} ( w^{(k)} )^{\rm T} \frac{1}{k !} \frac{ \partial^k } { t^k } Y(0, u) \]

Template Parameters
Basebase type for the operator; i.e., this operation sequence was recorded using AD< Base > and computations by this routine are done using type Base.
VectorBaseis a Simple Vector class with elements of type Base.
Parameters
qis the number of the number of Taylor coefficients that are being differentiated (per variable).
wis the weighting for each of the Taylor coefficients corresponding to dependent variables. If the argument w has size m * q , for $ k = 0 , \ldots , q-1 $ and $ i = 0, \ldots , m-1 $,

\[ w_i^{(k)} = w [ i * q + k ] \]

If the argument w has size m , for $ k = 0 , \ldots , q-1 $ and $ i = 0, \ldots , m-1 $,

\[ w_i^{(k)} = \left\{ \begin{array}{ll} w [ i ] & {\rm if} \; k = q-1 \\ 0 & {\rm otherwise} \end{array} \right. \]

Returns
Is a vector $ dw $ such that for $ j = 0 , \ldots , n-1 $ and $ k = 0 , \ldots , q-1 $

\[ dw[ j * q + k ] = W^{(1)} ( x )_{j,k} \]

where the matrix $ x $ is the value for $ u $ that corresponding to the forward mode Taylor coefficients for the independent variables as specified by previous calls to Forward.

Definition at line 91 of file reverse.hpp.

Referenced by CppAD::BenderQuad(), CppAD::ipopt::solve_callback< Dvector, ADvector, FG_eval >::eval_grad_f(), CppAD::ipopt::solve_callback< Dvector, ADvector, FG_eval >::eval_jac_g(), and CppAD::JacobianRev().