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_store_pv_op_0 ( size_t  i_z,
const addr_t *  arg,
size_t  num_par,
size_t  cap_order,
Base *  taylor,
bool *  isvar_by_ind,
size_t *  index_by_ind 

Zero order forward mode implementation of op = StpvOp.

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.
i_zis the index corresponding to the previous variable on the tape (only used for error checking).
is the offset of this VecAD vector relative to the beginning of the isvar_by_ind and index_by_ind arrays.

If this is a StppOp or StpvOp operation (if x is a parameter), i_vec is defined by
     i_vec = arg[1]
If this is a StvpOp or StvvOp 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.

index corresponding to the third operand for this operator; i.e. the index corresponding to y.
num_paris the total number of parameters on the tape (only used for error checking).
cap_ordernumber of columns in the matrix containing the Taylor coefficients.
taylorIn StvpOp and StvvOp cases, <taylor[ arg[1] * cap_order + 0 ] is used to compute the index in the definition of i_vec above.
isvar_by_indIf y is a varable (StpvOp and StvvOp cases), isvar_by_ind[ arg[0] + i_vec ] is set to true. Otherwise y is a paraemter (StppOp and StvpOp cases) and isvar_by_ind[ arg[0] + i_vec ] is set to false.
index_by_indindex_by_ind[ arg[0] - 1 ] is the number of elements in the user vector containing this element. The value index_by_ind[ arg[0] + i_vec] is set equal to arg[2].
Check User Errors
  • 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.
Checked Assertions
  • NumArg(op) == 3
  • NumRes(op) == 0
  • 0 < arg[0]
  • if y is a parameter, arg[2] < num_par

Definition at line 248 of file store_op.hpp.

Referenced by forward0sweep(), and forward1sweep().