Prev Next Index-> contents reference index search external Up-> CppAD ADFun Forward forward_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 Forward-> forward_zero forward_one forward_two forward_order forward_dir size_order compare_change capacity_order number_skip forward_one Headings-> Syntax Purpose f x0 x1 Vector Example Special Case

$\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}} }$
First Order Forward Mode: Derivative Values

Syntax
y1 = f.Forward(1, x1)

Purpose
We use $F : B^n \rightarrow B^m$ to denote the AD function corresponding to f . The result of the syntax above is $$y1 = F^{(1)} (x0) * x1$$ where $F^{(1)} (x0)$ is the Jacobian of $F$ evaluated at x0 .

f
The object f has prototype       ADFun<Base> f  Note that the ADFun object f is not const. Before this call to Forward, the value returned by       f.size_order()  must be greater than or equal one. After this call it will be will be two (see size_order ).

x0
The vector x0 in the formula $$y1 = F^{(1)} (x0) * x1$$ corresponds to the previous call to forward_zero using this ADFun object f ; i.e.,       f.Forward(0, x0)  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 x0 .

x1
The argument x1 has prototype       const Vector& x1  (see Vector below) and its size must be 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 forward.cpp contains an example and test of this operation. It returns true if it succeeds and false otherwise.

Special Case
This is special case of forward_order where $$\begin{array}{rcl} Y(t) & = & F[ X(t) ] \\ X(t) & = & x^{(0)} t^0 + x^{(1)} * t^1 + \cdots, + x^{(q)} * t^q + o( t^q ) \\ Y(t) & = & y^{(0)} t^0 + y^{(1)} * t^1 + \cdots, + y^{(q)} * t^q + o( t^q ) \end{array}$$ and $o( t^q ) * t^{-q} \rightarrow 0$ as $t \rightarrow 0$. For this special case, $q = 1$, $x^{(0)}$ = x0 , $x^{(1)}$ = x1 , $X(t) = x^{(0)} + x^{(1)} t$, and $$y^{(0)} + y^{(1)} t = F [ x^{(0)} + x^{(1)} t ] + o(t)$$ Taking the derivative with respect to $t$, at $t = 0$, we obtain $$y^{(1)} = F^{(1)} [ x^{(0)} ] x^{(1)}$$ which agrees with the specifications for y1 in the purpose above.
Input File: omh/forward/forward_one.omh