Prev Next Index-> contents reference index search external Up-> CppAD ADFun Reverse reverse_one CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix ADFun-> record_adfun drivers Forward Reverse sparsity_pattern sparse_derivative optimize abs_normal FunCheck check_for_nan Reverse-> reverse_one reverse_two reverse_any subgraph_reverse reverse_one-> reverse_one.cpp Headings-> Syntax Purpose f x w dw Vector Example

First Order Reverse Mode

Syntax
dw = f.Reverse(1, w)

Purpose
We use $F : B^n \rightarrow B^m$ to denote the AD function corresponding to f . The function $W : B^n \rightarrow B$ is defined by $$W(x) = w_0 * F_0 ( x ) + \cdots + w_{m-1} * F_{m-1} (x)$$ The result of this operation is the derivative $dw = W^{(1)} (x)$; i.e., $$dw = w_0 * F_0^{(1)} ( x ) + \cdots + w_{m-1} * F_{m-1}^{(1)} (x)$$ Note that if $w$ is the i-th elementary vector , $dw = F_i^{(1)} (x)$.

f
The object f has prototype       const ADFun<Base> f  Before this call to Reverse, the value returned by       f.size_order()  must be greater than or equal one (see size_order ).

x
The vector x in expression for dw above corresponds to the previous call to forward_zero using this ADFun object f ; i.e.,       f.Forward(0, x)  If there is no previous call with the first argument zero, the value of the independent variables during the recording of the AD sequence of operations is used for x .

w
The argument w has prototype       const Vector &w  (see Vector below) and its size must be equal to m , the dimension of the range space for f .

dw
The result dw has prototype       Vector dw  (see Vector below) and its value is the derivative $W^{(1)} (x)$. The size of dw is equal to n , the dimension of the domain space for f .

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

Example
The file reverse_one.cpp contains an example and test of this operation. It returns true if it succeeds and false otherwise.
Input File: omh/reverse/reverse_one.omh