--------------------------------------------------- lines 9-135 of file: include/cppad/core/for_two.hpp --------------------------------------------------- {xrst_begin ForTwo} {xrst_spell ddy } Forward Mode Second Partial Derivative Driver ############################################# Syntax ****** | *ddy* = *f* . ``ForTwo`` ( *x* , *j* , *k* ) Purpose ******* We use :math:`F : \B{R}^n \rightarrow \B{R}^m` to denote the :ref:`glossary@AD Function` corresponding to *f* . The syntax above sets .. math:: ddy [ i * p + \ell ] = \DD{ F_i }{ x_{j[ \ell ]} }{ x_{k[ \ell ]} } (x) for :math:`i = 0 , \ldots , m-1` and :math:`\ell = 0 , \ldots , p`, where :math:`p` is the size of the vectors *j* and *k* . f * The object *f* has prototype ``ADFun`` < *Base* > *f* Note that the :ref:`ADFun-name` object *f* is not ``const`` (see :ref:`ForTwo@ForTwo Uses Forward` below). x * The argument *x* has prototype ``const`` *BaseVector* & *x* (see :ref:`ForTwo@BaseVector` below) and its size must be equal to *n* , the dimension of the :ref:`fun_property@Domain` space for *f* . It specifies that point at which to evaluate the partial derivatives listed above. j * The argument *j* has prototype ``const`` *SizeVector_t* & *j* (see :ref:`ForTwo@SizeVector_t` below) We use *p* to denote the size of the vector *j* . All of the indices in *j* must be less than *n* ; i.e., for :math:`\ell = 0 , \ldots , p-1`, :math:`j[ \ell ] < n`. k * The argument *k* has prototype ``const`` *SizeVector_t* & *k* (see :ref:`ForTwo@SizeVector_t` below) and its size must be equal to *p* , the size of the vector *j* . All of the indices in *k* must be less than *n* ; i.e., for :math:`\ell = 0 , \ldots , p-1`, :math:`k[ \ell ] < n`. ddy *** The result *ddy* has prototype *BaseVector* *ddy* (see :ref:`ForTwo@BaseVector` below) and its size is :math:`m * p`. It contains the requested partial derivatives; to be specific, for :math:`i = 0 , \ldots , m - 1` and :math:`\ell = 0 , \ldots , p - 1` .. math:: ddy [ i * p + \ell ] = \DD{ F_i }{ x_{j[ \ell ]} }{ x_{k[ \ell ]} } (x) BaseVector ********** The type *BaseVector* must be a :ref:`SimpleVector-name` class with :ref:`elements of type Base` . The routine :ref:`CheckSimpleVector-name` will generate an error message if this is not the case. SizeVector_t ************ The type *SizeVector_t* must be a :ref:`SimpleVector-name` class with :ref:`elements of type size_t` . The routine :ref:`CheckSimpleVector-name` will generate an error message if this is not the case. ForTwo Uses Forward ******************* After each call to :ref:`Forward-name` , the object *f* contains the corresponding :ref:`Taylor coefficients` . After a call to ``ForTwo`` , the zero order Taylor coefficients correspond to *f* . ``Forward`` (0, *x* ) and the other coefficients are unspecified. Examples ******** {xrst_toc_hidden example/general/for_two.cpp } The routine :ref:`ForTwo` is both an example and test. It returns ``true`` , if it succeeds and ``false`` otherwise. {xrst_end ForTwo}