Prev Next

Declare Independent Variables and Start Recording

Syntax
Independent(x)

Purpose
Start recording AD of Base operations with x as the independent variable vector. Once the operation sequence is completed, it must be transferred to a function object; see below.

Start Recording
An operation sequence recording is started by the command
     Independent(
x)

Stop Recording
The recording is stopped, and the operation sequence is transferred to the AD function object f , using either the function constructor
     ADFun<
Basefxy)
or the dependent variable specifier
     
f.Dependent( xy)
The only other way to stop a recording is using abort_recording . Between when the recording is started and when it stopped, we refer to the elements of x , and the values that depend on the elements of x , as AD<Base> variables.

x
The vector x has prototype
     
VectorAD &x
(see VectorAD below). The size of the vector x , must be greater than zero, and is the number of independent variables for this AD operation sequence.

VectorAD
The type VectorAD must be a SimpleVector class with elements of type AD<Base> . The routine CheckSimpleVector will generate an error message if this is not the case.

Parallel Mode
The call to Independent, and the corresponding call to
     ADFun<
Basefxy)
or
     
f.Dependent( xy)
or abort_recording , must be preformed by the same thread; i.e., thread_alloc::thread_num must be the same.

Example
The file Independent.cpp contains an example and test of this operation. It returns true if it succeeds and false otherwise.
Input File: cppad/local/independent.hpp