Prev Next Index-> contents reference index search external Up-> CppAD ADFun drivers Jacobian 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 drivers-> Jacobian Hessian ForOne RevOne ForTwo RevTwo Jacobian-> jacobian.cpp Headings-> Syntax Purpose f x jac Vector Forward or Reverse Example

$\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}} }$
Jacobian: Driver Routine

Syntax
jac = f.Jacobian(x)

Purpose
We use $F : B^n \rightarrow B^m$ to denote the AD function corresponding to f . The syntax above sets jac to the Jacobian of F evaluated at x ; i.e., $$jac = F^{(1)} (x)$$

f
The object f has prototype       ADFun<Base> f  Note that the ADFun object f is not const (see Forward or Reverse below).

x
The argument x has prototype       const Vector &x  (see Vector 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 Jacobian.

jac
The result jac has prototype       Vector jac  (see Vector below) and its size is $m * n$; i.e., the product of the domain and range dimensions for f . For $i = 0 , \ldots , m - 1$ and $j = 0 , \ldots , n - 1$ $$. jac[ i * n + j ] = \D{ F_i }{ x_j } ( x )$$

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.

Forward or Reverse
This will use order zero Forward mode and either order one Forward or order one Reverse to compute the Jacobian (depending on which it estimates will require less work). After each call to Forward , the object f contains the corresponding Taylor coefficients . After a call to Jacobian, the zero order Taylor coefficients correspond to f.Forward(0, x) and the other coefficients are unspecified.

Example
The routine Jacobian is both an example and test. It returns true, if it succeeds and false otherwise.