\(\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}} }\)
Dependent¶
View page sourceStop Recording and Store Operation Sequence¶
Syntax¶
Dependent
( x , y )Stop Recording¶
The call stops the recording and the AD of Base operation sequence that started with the call
Independent
( x )
Store Operation Sequence¶
This call also stores the operation sequence in f . The operation sequence defines an AD Function
where \(B\) is the space corresponding to objects of type Base . The value \(n\) is the dimension of the Domain space for the operation sequence. The value \(m\) is the dimension of the 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 Independent . 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 ADvector 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 SimpleVector class with
elements of type
AD
< Base > .
The routine CheckSimpleVector 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 Forward calculation is preformed during this operation. Thus, directly after this operation,
f .
size_order
()
is zero (see size_order ).
Parallel Mode¶
The call to Independent
,
and the corresponding call to
ADFun
< Base > f ( x , y )
or
f .
Dependent
( x , y )
or abort_recording , must be preformed by the same thread; i.e., thread_alloc::thread_num must be the same.
Example¶
The file fun_check.cpp contains an example and test of this operation.