atomic_three_rev_depend

View page source

Atomic Function Reverse Dependency Calculation

Syntax

ok = afun . rev_depend (
      parameter_x , type_x , depend_x , depend_y
)

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

Example

The following is an example of a atomic function rev_depend definition: atomic_three_rev_depend.cpp .