CppAD: A C++ Algorithmic Differentiation Package
20171217
|
|
inline |
Zero order forward mode implementation of op = LdvOp.
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:
Base | base type for the operator; i.e., this operation was recorded using AD<Base> and computations by this routine are done using type Base. |
play | is the tape that this operation appears in. This is for error detection and not used when NDEBUG is defined. |
i_z | is the AD variable index corresponding to the variable z. |
arg | arg[0] is the offset of this VecAD vector relative to the beginning of the isvar_by_ind and index_by_ind arrays. arg[1] 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. |
parameter | If v[x] is a parameter, parameter[ i_v_x ] is its value. This vector has size play->num_par_rec(). |
cap_order | number of columns in the matrix containing the Taylor coefficients. |
taylor | Input 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]. Output taylor[ i_z * cap_order + 0 ] is set to the zero order Taylor coefficient for the variable z. |
isvar_by_ind | If 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_ind | index_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_op | is 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(). |
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 291 of file load_op.hpp.
Referenced by forward0sweep(), and forward1sweep().