CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
template<class Vector_set >
void CppAD::local::reverse_sparse_jacobian_cond_op ( bool  dependency,
size_t  i_z,
const addr_t *  arg,
size_t  num_par,
Vector_set &  sparsity 
)
inline

Compute reverse Jacobian sparsity patterns for op = CExpOp.

This routine is given the sparsity patterns for a function G(z, y, x, ... ) and it uses them to compute the sparsity patterns for

     H( y, x, w , u , ... ) = G[ z(x,y) , y , x , w , u , ... ]

where y represents the combination of y_0, y_1, y_2, and y_3.

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
Vector_setis the type used for vectors of sets. It can be either sparse_pack or sparse_list.
Parameters
i_zis 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_paris the total number of values in the vector parameter.
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.
Parameters
dependencyAre the derivatives with respect to left and right of the expression below considered to be non-zero:
CondExpRel(left, right, if_true, if_false)
This is used by the optimizer to obtain the correct dependency relations.
sparsityif y_2 is a variable, the set with index t is the sparsity pattern corresponding to y_2. This identifies which of the dependent variables depend on the variable y_2. On input, this pattern corresponds to the function G. On ouput, it corresponds to the function H.

if y_3 is a variable, the set with index t is the sparsity pattern corresponding to y_3. This identifies which of the dependent variables depeond on the variable y_3. On input, this pattern corresponds to the function G. On ouput, it corresponds to the function H.
Output: The set with index T is the sparsity pattern corresponding to z. This identifies which of the dependent variables depend on the variable z. On input and output, this pattern corresponds to the function G.

Definition at line 1122 of file cond_op.hpp.

Referenced by rev_jac_sweep().