lines 8-123 of file: include/cppad/core/dependent.hpp

{xrst_begin Dependent}

Stop Recording and Store Operation Sequence
###########################################

Syntax
******
*f* . ``Dependent`` ( *x* , *y* )

Purpose
*******
Stop recording and the AD of *Base*
:ref:`operation sequence<glossary@Operation@Sequence>`
that started with the call

   ``Independent`` ( *x* )

and store the operation sequence in *f* .
The operation sequence defines an
:ref:`glossary@AD Function`

.. math::

   F : \B{R}^n \rightarrow \B{R}^m

where :math:`B` is the space corresponding to objects of type *Base* .
The value :math:`n` is the dimension of the
:ref:`fun_property@Domain` space for the operation sequence.
The value :math:`m` is the dimension of the
:ref:`fun_property@Range` space for the operation sequence
(which is determined by the size of *y* ).

f
*
The object *f* has prototype

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

The AD of *Base* operation sequence is stored in *f* ; i.e.,
it becomes the operation sequence corresponding to *f* .
If a previous operation sequence was stored in *f* ,
it is deleted.

x
*
The argument *x*
must be the vector argument in a previous call to
:ref:`Independent-name` .
Neither its size, or any of its values, are allowed to change
between calling

   ``Independent`` ( *x* )

and

   *f* . ``Dependent`` ( *x* , *y* )

.

y
*
The vector *y* has prototype

   ``const`` *ADvector* & *y*

(see :ref:`ADvector<fun_construct-name>` below).
The length of *y* must be greater than zero
and is the dimension of the range space for *f* .

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

Taping
******
The tape,
that was created when ``Independent`` ( *x* ) was called,
will stop recording.
The AD operation sequence will be transferred from
the tape to the object *f* and the tape will then be deleted.

Forward
*******
No :ref:`Forward-name` calculation is preformed during this operation.
Thus, directly after this operation,

   *f* . ``size_order`` ()

is zero (see :ref:`size_order-name` ).

Parallel Mode
*************
The call to ``Independent`` ,
and the corresponding call to

   ``ADFun`` < *Base* > *f* ( *x* , *y* )

or

   *f* . ``Dependent`` ( *x* , *y* )

or :ref:`abort_recording-name` ,
must be preformed by the same thread; i.e.,
:ref:`thread_alloc::thread_num<ta_thread_num-name>` must be the same.

Example
*******
The file
:ref:`fun_check.cpp-name`
contains an example and test of this operation.

{xrst_end Dependent}
