lines 9-113 of file: include/cppad/core/rev_one.hpp

{xrst_begin RevOne}
{xrst_spell
   dw
}

First Order Derivative: Driver Routine
######################################

Syntax
******
*dw* = *f* . ``RevOne`` ( *x* , *i* )

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 *dw* to the
derivative of :math:`F_i` with respect to :math:`x`; i.e.,

.. math::

   dw =
   F_i^{(1)} (x)
   = \left[
      \D{ F_i }{ x_0 } (x) , \cdots , \D{ F_i }{ x_{n-1} } (x)
   \right]

f
*
The object *f* has prototype

   ``ADFun`` < *Base* > *f*

Note that the :ref:`ADFun-name` object *f* is not ``const``
(see :ref:`RevOne@RevOne Uses Forward` below).

x
*
The argument *x* has prototype

   ``const`` *Vector* & *x*

(see :ref:`RevOne@Vector` 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 derivative.

i
*
The index *i* has prototype

   ``size_t`` *i*

and is less than :math:`m`, the dimension of the
:ref:`fun_property@Range` space for *f* .
It specifies the
component of :math:`F` that we are computing the derivative of.

dw
**
The result *dw* has prototype

   *Vector* *dw*

(see :ref:`RevOne@Vector` below)
and its size is *n* , the dimension of the
:ref:`fun_property@Domain` space for *f* .
The value of *dw* is the derivative of :math:`F_i`
evaluated at *x* ; i.e.,
for :math:`j = 0 , \ldots , n - 1`

.. math::

   dw[ j ] = \D{ F_i }{ x_j } ( x )

Vector
******
The type *Vector* must be a :ref:`SimpleVector-name` class with
:ref:`elements of type<SimpleVector@Elements of Specified Type>`
*Base* .
The routine :ref:`CheckSimpleVector-name` will generate an error message
if this is not the case.

RevOne Uses Forward
*******************
After each call to :ref:`Forward-name` ,
the object *f* contains the corresponding
:ref:`Taylor coefficients<glossary@Taylor Coefficient>` .
After a call to ``RevOne`` ,
the zero order Taylor coefficients correspond to
*f* . ``Forward`` (0, *x* )
and the other coefficients are unspecified.

Example
*******
{xrst_toc_hidden
   example/general/rev_one.cpp
}
The routine
:ref:`RevOne<rev_one.cpp-name>` is both an example and test.
It returns ``true`` , if it succeeds and ``false`` otherwise.

{xrst_end RevOne}
