Prev Next

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@This is cppad-20221105 documentation. Here is a link to its current documentation .
C++ AD Graph Operator Enum Type

Unary
The unary operators have one argument and one result node. The argument is a node index and the result is the next node.

Binary
The binary operators have two arguments and one result node. The arguments are node indices and the result is the next node. The first (second) argument is the left (right) operand node index.

Conditional Expression
The conditional expression operators have four arguments and one result node. The arguments are node indices and the result is the next node. The first argument is left , the second is right , the third is if_true , the fourth is if_false , the result is given by
    if( 
left cop right)
        
result = if_true;
    else
        
result = if_false;
where cop is given in the comment after the enum type values below.

Other Comparisons
Note that
    CondExpGt(
leftrightif_trueif_false)
is equivalent to
    CondExpLe(
leftrightif_falseif_true)
Similar conversions can be used for all the possible conditional expressions .

Comparison
The comparison operators have two arguments and no result node. The first (second) argument is the left (right) operand node index. The comparison result was true for the value of the independent dynamic parameters and independent variables at which this graph was created.

Other Comparisons
The comparison result true for left > right is equivalent to the comparison result true for right < left . The comparison result false for left > right is equivalent to the comparison result true for left <= right . In a similar fashion, all the possible comparisons results can be converted to a true result for one of the comparisons above.

Summation
The summation operator has one node result and a variable number of arguments. The first argument is the number of nodes in the summation, and the other arguments are the indices of the nodes to be summed. The total number of arguments for this operator is one plus the number of nodes in the summation.

Discrete Function
The discrete function operator has two arguments and one node result. The first argument is the index in discrete_name_vec for the name of the discrete function that is called. The second argument is the index of the node that is the argument to the discrete function.

Atomic Function
The atomic function operator has a variable number of arguments and a variable number of result nodes. There are three extra arguments for atomic_three functions and four extra arguments for atomic_four functions. The total number of operator arguments is the number of extra arguments plus the number of arguments for the function being called. The extra arguments come before the function arguments.
  1. The first operator argument is function name represented by it's index in the atomic_name_vec .
  2. If this is an atomic four function call, the second operator argument is the call_id .
  3. In the atomic three (atomic four) case, second (third) operator argument is the number of results for this function call. The order of the function results is determined by the function being called.
  4. In the atomic three (atomic four) case, the third (fourth) operator argument is the number of arguments for this function call.
  5. The rest of the operator arguments are the node indices for each of the function arguments. The order of the function arguments is determined by function being called.


Print
The print operator has four arguments.
  1. The first argument is the index in print_text_vec for the before text for this print operator.
  2. The second argument is the index in print_text_vec for the after text for this print operator.
  3. The third argument is the node corresponding to notpos for this print operator.
  4. The fourth argument is the node corresponding to value for this print operator.


Missing Operators
As of yet the following ADFun operators do not have a corresponding graph operator:
  1. Operators to load and store VecAD elements.
  2. An operator for the atomic_two interface.


Enum Values

namespace CppAD { namespace graph {
    enum graph_op_enum {
        abs_graph_op,      // unary: absolute value
        acos_graph_op,     // unary: inverse cosine
        acosh_graph_op,    // unary: inverse hyperbolic cosine
        add_graph_op,      // binary: addition
        asin_graph_op,     // unary: inverse sine
        asinh_graph_op,    // unary: inverse hyperbolic sine
        atan_graph_op,     // unary: inverse tangent
        atanh_graph_op,    // unary: inverse hyperbolic tangent
        atom_graph_op,     // atomic three function call
        atom4_graph_op,    // atomic four function call
        azmul_graph_op,    // binary: absolute zero multiplication
        cexp_eq_graph_op,  // conditional expression: ==
        cexp_le_graph_op,  // conditional expression: <=
        cexp_lt_graph_op,  // conditional expression: <
        comp_eq_graph_op,  // comparison: ==
        comp_le_graph_op,  // comparison: <=
        comp_lt_graph_op,  // comparison: <
        comp_ne_graph_op,  // comparison: !=
        cos_graph_op,      // unary: cosine
        cosh_graph_op,     // unary: hyperbolic cosine
        discrete_graph_op, // discrete function
        div_graph_op,      // binary: division
        erf_graph_op,      // unary: error function
        erfc_graph_op,     // unary: complementary error function
        exp_graph_op,      // unary: exponential
        expm1_graph_op,    // unary: exponential minus one
        log1p_graph_op,    // unary: logarithm of one plus argument
        log_graph_op,      // unary: logarithm
        neg_graph_op,      // unary: minus
        mul_graph_op,      // binary: multiplication
        pow_graph_op,      // binary: first argument raised to second argument
        print_graph_op,    // print during zero order forward
        sign_graph_op,     // unary: sign of argument
        sin_graph_op,      // unary: sine
        sinh_graph_op,     // unary: hyperbolic sine
        sqrt_graph_op,     // unary: square root
        sub_graph_op,      // binary: subtraction
        sum_graph_op,      // summation
        tan_graph_op,      // unary: tangent
        tanh_graph_op,     // unary: hyperbolic tangent
        n_graph_op         // number of graph_op_enum operators
    };
} }

Examples

Contents
graph_azmul_op.cppC++ AD Graph add Operator: Example and Test
graph_add_op.cppC++ AD Graph add Operator: Example and Test
graph_div_op.cppC++ AD Graph div Operator: Example and Test
graph_mul_op.cppC++ AD Graph mul Operator: Example and Test
graph_pow_op.cppC++ AD Graph pow Operator: Example and Test
graph_sub_op.cppC++ AD Graph sub Operator: Example and Test
graph_unary_op.cppGraph Unary Operator: Example and Test
graph_sum_op.cppC++ AD Graph sum Operator: Example and Test
graph_comp_op.cppC++ AD Graph Comparison Operators: Example and Test
graph_cexp_op.cppC++ AD Graph Conditional Expressions: Example and Test
graph_discrete_op.cppC++ AD Graph add Operator: Example and Test
graph_atom_op.cppC++ AD Graph Atomic Three Functions: Example and Test
graph_atom4_op.cppC++ AD Graph Atomic Four Functions: Example and Test
graph_print_op.cppC++ AD Graph print Operator: Example and Test

Input File: include/cppad/core/graph/graph_op_enum.hpp