CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
size_t CppAD::local::arg_is_variable ( OpCode  op,
const addr_t *  arg,
pod_vector< bool > &  is_variable 

Determines which arguments are variaibles for an operator.

opis the operator. Note that CSkipOp and CSumOp are special cases because the true number of arguments is not equal to NumArg(op) and the true number of arguments num_arg can be large. It may be more efficient to handle these cases separately (see below).
argis the argument vector for this operator.
is_variableIf the input value of the elements in this vector do not matter. Upon return, for j < NumArg(op), the j-th argument for this operator is a variable index if and only if is_variable[j] is true. Note that the variable index 0, for the BeginOp, does not correspond to a real variable and false is returned for this case.
The return value is the true number of arguments num_arg. If op is CSkipOp or CSumOp, see below. Otherwise the true number of arguments num_arg = NumArg(op). If the input size of is_variable is less than num_arg, is_variable.extend is used to increase its size to be num_arg.
In the case of CSkipOp,
num_arg = 7 + arg[4] + arg[5];
is_variable[2] = (arg[1] & 1) != 0;
is_variable[3] = (arg[1] & 2) != 0;
and all the other is_variable values are false.
In the case of CSumOp,
num_arg = 4 + arg[0] + arg[1];
for(size_t i = 3; i < num_arg - 1; ++i)
is_variable[i] = true;
and all the other is_variable values are false.

Definition at line 911 of file op_code.hpp.

Referenced by CppAD::local::subgraph::get_argument_variable(), and CppAD::local::optimize::match_op().