CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
template<class Base >
void CppAD::local::forward_load_p_op_0 ( const local::player< Base > *  play,
size_t  i_z,
const addr_t *  arg,
const Base *  parameter,
size_t  cap_order,
Base *  taylor,
bool *  isvar_by_ind,
size_t *  index_by_ind,
addr_t *  var_by_load_op 

Zero order forward mode implementation of op = LdpOp.

The C++ source code corresponding to this operation is

     v[x] = y

where v is a VecAD<Base> vector, x is an AD<Base> object, and y is AD<Base> or Base objects. We define the index corresponding to v[x] by

     i_v_x = index_by_ind[ arg[0] + i_vec ]

where i_vec is defined under the heading arg[1] below:

Template Parameters
Basebase type for the operator; i.e., this operation was recorded using AD<Base> and computations by this routine are done using type Base.
playis the tape that this operation appears in. This is for error detection and not used when NDEBUG is defined.
i_zis the AD variable index corresponding to the variable z.
arg[0] is the offset of this VecAD vector relative to the beginning of the isvar_by_ind and index_by_ind arrays.

If this is the LdpOp operation (if x is a parameter), i_vec is defined by
     i_vec = arg[1]
If this is the LdvOp operation (if x is a variable), i_vec is defined by
     i_vec = floor( taylor[ arg[1] * cap_order + 0 ] )
where floor(c) is the greatest integer less that or equal c.

arg[2] Is the index of this vecad load instruction in the var_by_load_op array.
parameterIf v[x] is a parameter, parameter[ i_v_x ] is its value. This vector has size play->num_par_rec().
cap_ordernumber of columns in the matrix containing the Taylor coefficients.
In LdvOp case, taylor[ arg[1] * cap_order + 0 ] is used to compute the index in the definition of i_vec above. If v[x] is a variable, taylor[ i_v_x * cap_order + 0 ] is the zero order Taylor coefficient for v[x].

taylor[ i_z * cap_order + 0 ] is set to the zero order Taylor coefficient for the variable z.
isvar_by_indIf isvar_by_ind[ arg[0] + i_vec ] is true, v[x] is a variable. Otherwise it is a parameter. This vector has size play->num_vec_ind_rec().
index_by_indindex_by_ind[ arg[0] - 1 ] is the number of elements in the user vector containing this element. index_by_ind[ arg[0] + i_vec ] is the variable or parameter index for this element, This array has size play->num_vec_ind_rec().
var_by_load_opis a vector with size play->num_load_op_rec(). The input value of its elements does not matter. Upon return, it contains the variable index corresponding to each load instruction. In the case where the index is zero, the instruction corresponds to a parameter (not variable). This array has size play->num_load_op_rec().
Check User Errors
  • In the LdvOp case check that the index is with in range; i.e. i_vec < index_by_ind[ arg[0] - 1 ]. Note that, if x is a parameter, the corresponding vector index and it does not change. In this case, the error above should be detected during tape recording.

Definition at line 247 of file load_op.hpp.

Referenced by forward0sweep(), and forward1sweep().