\(\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}} }\)
atomic_three_rev_depend¶
View page sourceAtomic Function Reverse Dependency Calculation¶
Syntax¶
rev_depend
(Prototype¶
template <class Base>
bool atomic_three<Base>::rev_depend(
const vector<Base>& parameter_x ,
const vector<ad_type_enum>& type_x ,
vector<bool>& depend_x ,
const vector<bool>& depend_y )
Dependency Analysis¶
This calculation is sometimes referred to as a reverse dependency analysis.
Implementation¶
This function must be defined if afun is used to define an ADFun object f , and f.optimize() is used.
Base¶
See Base .
parameter_x¶
See parameter_x .
type_x¶
See type_x .
depend_x¶
This vector has size equal to the number of arguments for this atomic function;
i.e. n = ax . size
() .
The input values of the elements of depend_x
are not specified (must not matter).
Upon return, for \(j = 0 , \ldots , n-1\),
depend_x [ j ] is true if the values of interest depend
on the value of ax[j] in the corresponding
afun ( ax , ay ) call.
Optimize¶
Parameters and variables, that the values of interest do not depend on, may get removed by optimization . The corresponding values in parameter_x , and taylor_x (after optimization has removed them) are not specified.
depend_y¶
This vector has size equal to the number of results for this atomic function;
i.e. m = ay . size
() .
For \(i = 0 , \ldots , m-1\),
depend_y [ i ] is true if the values of interest depend
on the value of ay[i] in the corresponding
afun ( ax , ay ) call.
ok¶
If this calculation succeeded, ok is true. Otherwise, it is false.
Contents¶
Name |
Title |
---|---|
atomic_three_rev_depend.cpp |
Atomic Functions Reverse Dependency Analysis: Example and Test |
Example¶
The following is an example of a atomic function rev_depend
definition:
atomic_three_rev_depend.cpp .