CppAD: A C++ Algorithmic Differentiation Package  20130102
template<class Base >
void ReverseSweep ( size_t  d,
size_t  n,
size_t  numvar,
player< Base > *  Rec,
size_t  J,
const Base *  Taylor,
size_t  K,
Base *  Partial 
)

Compute derivative of arbitrary order forward mode Taylor coefficients.

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.
Parameters:
dis the highest order Taylor coefficients that we are computing the derivative of.
nis the number of independent variables on the tape.
numvaris the total number of variables on the tape. This is also equal to the number of rows in the matrix Taylor; i.e., Rec->num_rec_var().
RecThe information stored in Rec is a recording of the operations corresponding to the function

\[ F : {\bf R}^n \rightarrow {\bf R}^m \]

where $ n $ is the number of independent variables and $ m $ is the number of dependent variables. We define the function $ G : {\bf R}^{n \times d} \rightarrow {\bf R} $ by

\[ G( u ) = \frac{1}{d !} \frac{ \partial^d }{ \partial t^d } \left[ \sum_{i=1}^m w_i F_i ( u^{(0)} + u^{(1)} t + \cdots + u^{(d)} t^d ) \right]_{t=0} \]

Note that the scale factor 1 / a d converts the d-th partial derivative to the d-th order Taylor coefficient. This routine computes the derivative of $ G(u) $ with respect to all the Taylor coefficients $ u^{(k)} $ for $ k = 0 , ... , d $. The vector $ w \in {\bf R}^m $, and value of $ u \in {\bf R}^{n \times d} $ at which the derivative is computed, are defined below.

The object Rec is effectly constant. There is an exception to this, while palying back the tape the object Rec holds information about the current location with in the tape and this changes during palyback.
JIs the number of columns in the coefficient matrix Taylor. This must be greater than or equal d + 1.
TaylorFor i = 1 , ... , numvar, and for k = 0 , ... , d, Taylor [ i * J + k ] is the k-th order Taylor coefficient corresponding to variable with index i on the tape. The value $ u \in {\bf R}^{n \times d} $, at which the derivative is computed, is defined by $ u_j^{(k)} $ = Taylor [ j * J + k ] for j = 1 , ... , n, and for k = 0 , ... , d.
KIs the number of columns in the partial derivative matrix Partial. It must be greater than or equal d + 1.
PartialInput: The last $ m $ rows of Partial are inputs. The vector $ v $, used to define $ G(u) $, is specified by these rows. For i = 0 , ... , m - 1, Partial [ ( numvar - m + i ) * K + d ] = v_i. For i = 0 , ... , m - 1 and for k = 0 , ... , d - 1, Partial [ ( numvar - m + i ) * K + k ] = 0.

Temporary: For i = n+1 , ... , numvar - 1 and for k = 0 , ... , d, the value of Partial [ i * K + k ] is used for temporary work space and its output value is not defined.

Output: For j = 1 , ... , n and for k = 0 , ... , d, Partial [ j * K + k ] is the partial derivative of $ G( u ) $ with respect to $ u_j^{(k)} $.
Assumptions
The first operator on the tape is a BeginOp, and the next n operators are InvOp operations for the corresponding independent variables.

Definition at line 133 of file reverse_sweep.hpp.

Referenced by ADFun< Base >::Reverse().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines