|
template<class Base >
void reverse_cond_op |
( |
size_t |
d, |
|
|
size_t |
i_z, |
|
|
const size_t * |
arg, |
|
|
size_t |
num_par, |
|
|
const Base * |
parameter, |
|
|
size_t |
nc_taylor, |
|
|
const Base * |
taylor, |
|
|
size_t |
nc_partial, |
|
|
Base * |
partial |
|
) |
| [inline] |
Compute reverse mode Taylor coefficients for op = CExpOp.
The C++ source code coresponding to this operation is
z = CondExpRel(y_0, y_1, y_2, y_3)
where Rel is one of the following: Lt, Le, Eq, Ge, Gt.
- 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 static cast to size_t from the enum type
enum CompareOp {
CompareLt,
CompareLe,
CompareEq,
CompareGe,
CompareGt,
CompareNe
}
for this operation. Note that arg[0] cannot be equal to CompareNe.
arg[1] & 1
If this is zero, y_0 is a parameter. Otherwise it is a variable.
arg[1] & 2
If this is zero, y_1 is a parameter. Otherwise it is a variable.
arg[1] & 4
If this is zero, y_2 is a parameter. Otherwise it is a variable.
arg[1] & 8
If this is zero, y_3 is a parameter. Otherwise it is a variable.
arg[2 + j ] for j = 0, 1, 2, 3
is the index corresponding to y_j. |
num_par | is the total number of values in the vector parameter. |
parameter | For j = 0, 1, 2, 3, if y_j is a parameter, parameter [ arg[2 + j] ] is its value. |
nc_taylor | number of columns in the matrix containing the Taylor coefficients. |
- Checked Assertions
- NumArg(CExpOp) == 6
- NumRes(CExpOp) == 1
- arg[0] < static_cast<size_t> ( CompareNe )
- arg[1] != 0; i.e., not all of y_0, y_1, y_2, y_3 are parameters.
- For j = 0, 1, 2, 3 if y_j is a parameter, arg[2+j] < num_par.
- For j = 0, 1, 2, 3 if y_j is a variable, arg[2+j] < iz.
This routine is given the partial derivatives of a function G( z , y , x , w , ... ) and it uses them to compute the partial derivatives of
H( y , x , w , u , ... ) = G[ z(y) , y , x , w , u , ... ]
where y above represents y_0, y_1, y_2, y_3.
- Parameters:
-
d | is the order of the Taylor coefficient of z that we are computing. |
taylor | Input: For j = 0, 1, 2, 3 and k = 0 , ... , d, if y_j is a variable then taylor [ arg[2+j] * nc_taylor + k ] is the k-th order Taylor coefficient corresponding to y_j.
taylor [ i_z * nc_taylor + k ] for k = 0 , ... , d is the k-th order Taylor coefficient corresponding to z. |
nc_partial | number of columns in the matrix containing the Taylor coefficients. |
partial | Input: For j = 0, 1, 2, 3 and k = 0 , ... , d, if y_j is a variable then partial [ arg[2+j] * nc_partial + k ] is the partial derivative of G( z , y , x , w , u , ... ) with respect to the k-th order Taylor coefficient corresponding to y_j.
Input: partial [ i_z * nc_taylor + k ] for k = 0 , ... , d is the partial derivative of G( z , y , x , w , u , ... ) with respect to the k-th order Taylor coefficient corresponding to z.
Output: For j = 0, 1, 2, 3 and k = 0 , ... , d, if y_j is a variable then partial [ arg[2+j] * nc_partial + k ] is the partial derivative of H( y , x , w , u , ... ) with respect to the k-th order Taylor coefficient corresponding to y_j. |
Definition at line 249 of file cond_op.hpp.
Referenced by ReverseSweep().
|