|
template<class Base >
void forward_load_p_op_0 |
( |
size_t |
i_z, |
|
|
size_t * |
arg, |
|
|
size_t |
num_par, |
|
|
const Base * |
parameter, |
|
|
size_t |
nc_taylor, |
|
|
Base * |
taylor, |
|
|
size_t |
nc_combined, |
|
|
const bool * |
variable, |
|
|
const size_t * |
combined |
|
) |
| [inline] |
Zero order forward mode implementation of op = LdpOp.
The C++ source code corresponding to this operation is
where y is a VecAD<Base> vector and x is an AD<Base> index. We define the index corresponding to y[x] by
i_y_x = combined[ arg[0] + i_vec ]
where i_vec is defined under the heading arg[1] below:
- Template Parameters:
-
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. |
- Parameters:
-
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 combined VecAD array.
arg[1]
If this is the LdpOp operation (the index x is a parameter), i_vec is defined by If this is the LdvOp operation (the index x is a variable), i_vec is defined by
i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] )
where floor(c) is the greatest integer less that or equal c.
arg[2] Input: The input value of arg[2] does not matter.
Output: If y[x] is a parameter, arg[2] is set to zero (which is not a valid variable index). If y[x] is a variable, arg[2] is set to the variable index corresponding to y[x]; i.e. i_y_x. |
num_par | is the number of parameters in parameter. |
parameter | If y[x] is a parameter, parameter [ i_y_x ] is its value. |
nc_taylor | number of columns in the matrix containing the Taylor coefficients. |
taylor | Input: in LdvOp case, taylor[ arg[1] * nc_taylor + 0 ] is used to compute the index in the definition of i_vec above
Input: if y[x] is a variable, taylor[ i_y_x * nc_taylor + 0 ] is the zero order Taylor coefficient for y[x].
Output: taylor[ i_z * nc_taylor + 0 ] is the zero order Taylor coefficient for the variable z. |
nc_combined | is the total number of elements in the combined VecAD array. |
variable | If variable [ arg[0] + i_vec ] is true, y[x] is a variable. Otherwise it is a parameter. |
combined | Input: combined[ arg[0] - 1 ] is the number of elements in the VecAD vector containing this element.
Input: combined[ arg[0] + i_vec ] if y[x] is a variable, i_y_x is its index in the Taylor coefficient array taylor. Otherwise, i_y_x is its index in parameter array parameter. |
- Check User Errors
- In the LdvOp case check that the index is with in range; i.e. i_vec < combined[ arg[0] - 1 ]
- Checked Assertions
- combined != CPPAD_NULL
- variable != CPPAD_NULL
- NumArg(LdpOp) == 3
- NumRes(LdpOp) == 1
- 0 < arg[0]
- arg[0] + i_vec < nc_combined
- i_vec < combined[ arg[0] - 1 ]
- if y[x] is a parameter, i_y_x < num_par
- if y[x] is a variable, i_y_x < i_z
- if x is a variable (LpvOp case), arg[1] < i_z
Definition at line 29 of file load_op.hpp.
Referenced by forward0sweep(), and forward_sweep().
|