Prev Next

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@This is cppad-20221105 documentation. Here is a link to its current documentation .
Reverse Mode Second Partial Derivative Driver

Syntax
ddw = f.RevTwo(xij)

Purpose
We use @(@ F : \B{R}^n \rightarrow \B{R}^m @)@ to denote the AD function corresponding to f . The syntax above sets @[@ ddw [ k * p + \ell ] = \DD{ F_{i[ \ell ]} }{ x_{j[ \ell ]} }{ x_k } (x) @]@ for @(@ k = 0 , \ldots , n-1 @)@ and @(@ \ell = 0 , \ldots , p @)@, where @(@ p @)@ is the size of the vectors i and j .

f
The object f has prototype
    ADFun<
Basef
Note that the ADFun object f is not const (see RevTwo Uses Forward below).

x
The argument x has prototype
    const 
BaseVector &x
(see BaseVector below) and its size must be equal to n , the dimension of the domain space for f . It specifies that point at which to evaluate the partial derivatives listed above.

i
The argument i has prototype
    const 
SizeVector_t &i
(see SizeVector_t below) We use p to denote the size of the vector i . All of the indices in i must be less than m , the dimension of the range space for f ; i.e., for @(@ \ell = 0 , \ldots , p-1 @)@, @(@ i[ \ell ] < m @)@.

j
The argument j has prototype
    const 
SizeVector_t &j
(see SizeVector_t below) and its size must be equal to p , the size of the vector i . All of the indices in j must be less than n ; i.e., for @(@ \ell = 0 , \ldots , p-1 @)@, @(@ j[ \ell ] < n @)@.

ddw
The result ddw has prototype
    
BaseVector ddw
(see BaseVector below) and its size is @(@ n * p @)@. It contains the requested partial derivatives; to be specific, for @(@ k = 0 , \ldots , n - 1 @)@ and @(@ \ell = 0 , \ldots , p - 1 @)@ @[@ ddw [ k * p + \ell ] = \DD{ F_{i[ \ell ]} }{ x_{j[ \ell ]} }{ x_k } (x) @]@

BaseVector
The type BaseVector must be a SimpleVector class with elements of type Base . The routine CheckSimpleVector will generate an error message if this is not the case.

SizeVector_t
The type SizeVector_t must be a SimpleVector class with elements of type size_t . The routine CheckSimpleVector will generate an error message if this is not the case.

RevTwo Uses Forward
After each call to Forward , the object f contains the corresponding Taylor coefficients . After a call to RevTwo, the zero order Taylor coefficients correspond to f.Forward(0, x) and the other coefficients are unspecified.

Examples
The routine RevTwo is both an example and test. It returns true, if it succeeds and false otherwise.
Input File: include/cppad/core/rev_two.hpp