Prev | Next |
x
is called the independent variable vector,
p
is called the independent dynamic parameter vector,
and
y
is called the dependent variable vector.
p_0 , ... , p_{np-1} ,
x_0 , ... , x_{nx-1} ,
c_0 , ... , c_{nc-1} ,
r_0 , ... , r_{no-1}
p_0, ... , p_{np-1}
is the independent dynamic parameter vector;
see n_dynamic_ind
.
The node index corresponding to
p_0
is 1
.
x_1, ... , x_nx
is the independent variable vector;
see n_variable_ind
.
The node index corresponding to
x_0
is
the index corresponding to
p_0
plus
np
.
c_1, ... , c_nc
is the constant parameter vector;
see constant_vec
.
The node index corresponding to
c_0
is
the index corresponding to
x_0
plus
nx
.
r_i
for
i=0,...,no-1
is the result vector
for the i
-th operator;
see operator_vec
.
All of the node arguments for an the i
-th operator are nodes
that come before the first element of
r_i
.
The node index corresponding to the first element of
r_0
is
the index corresponding to
c_0
plus
nc
.
For
i > 0
,
The node index corresponding to the first element of
r_i
is
the index corresponding to the first element of
r_{i-1}
plus
the number of results for the i-1
-th operator.
std::string
containing the name for the function
corresponding to this graph.
std::string
.
A discrete function has one argument, one result, and it derivative
is always zero; e.g., the Heaviside function.
Calls by this function to discrete functions use the index in this
vector to identify the discrete functions; see
discrete_graph_op
below.
If there are no calls to discrete functions, this vector can be empty.
std::string
.
An atomic function can have any number of arguments and results
and non-zero derivatives.
Calls by this function to other functions use the index in this
vector to identify the other functions; see
atom_graph_op
below.
If there are no calls to other functions, this vector can be empty.
Discrete functions are faster, and simpler to create and use
than atomic functions.
std::string
.
The print
operators uses indices
in this vector for the corresponding
before
and after
values.
If there are no print operators, this vector can be empty.
np
above); see
dynamic
.
nx
above); see
x
.
double
and size
nc
that can be used to define this function.
graph_op_enum
and size
no
(the number of operators in the graph).
For
i= 0, ..., no-1
operator_vec[i]
contains the instructions
for computing the result vector
r_i
.
i= 0, ..., no-1
, we use
first_node[i]
to denote the index in
operator_arg
of the first node argument to the i
-th operator.
We use
n_node_arg[i]
to denote the number of node arguments
for the i
-th operator.
For
j = 0 , ..., n_node_arg[i]-1
,
the j
-th node argument for the i
-th operator has node index
operator_arg[ first_node[i] + j ]
The
operator_arg
sub-vector for the i
-th operator starts are
first_node[i]
and has
n_node_arg[i]
elements
except for the following operators:
sum_graph_op
,
discrete_graph_op
,
atom_graph_op
,
print_graph_op
.
operator_vec[i].op_enum
is
print_graph_op
:
before[i] = operator_arg[ first_node[i] - 2 ]
is the index in print_text_vec
of the text that is printed before the value and
after[i] = operator_arg[ first_node[i] - 1 ]
is the index in print_text_vec
of the text that is printed after the value.
The
operator_arg
sub-vector for the i
-th operator
starts at index
first_node[i]-2
and has
4 = n_node_arg[i]+2
elements.
The node with index
notpos[i] = operator_arg[ first_node[i] ]
is checked and if it is positive, nothing is printed by this operator.
Otherwise, the value corresponding to the following node is printed:
value[i] = operator_arg[ first_node[i] + 1 ]
operator_vec[i].op_enum
is
discrete_graph_op
:
name_index[i] = operator_arg[ first_node[i] - 1 ]
is the index in discrete_name_vec
of the function being called by this operator.
For this operator,
the
operator_arg
sub-vector for the i
-th operator
starts at index
first_node[i]-1
and has
2 = n_node_arg[i]+1
elements.
operator_vec[i].op_enum
is
atom_graph_op
:
name_index[i] = operator_arg[ first_node[i] - 3 ]
is the index in atomic_name_vec
of the function being called by this operator.
n_result[i] = operator_arg[ first_node[i] - 2 ]
is the number of result nodes for this operator.
n_node_arg[i] = operator_arg[ first_node[i] - 1 ]
is the number of node arguments for this operator.
For this operator,
the
operator_arg
sub-vector for the i
-th operator
starts at index
first_node[i]-3
and has
n_node_arg[i]+3
elements.
operator_vec[i].op_enum
is
sum_graph_op
:
n_node_arg[i] = operator_arg[ first_node[i] - 1 ]
is the number of node arguments for this operator.
For this operator,
the
operator_arg
sub-vector for the i
-th operator
starts at index
first_node[i]-1
and has
n_node_arg[i]+1
elements.
y
.
The i
-th element of
y
corresponds to the node index
dependent_vec[i]
.
cpp_graph
class implements the data structure above.
It is defined by the documentation sections under Contents below:
graph_op_enum | C++ AD Graph Operator Enum Type |
cpp_graph | A C++ AD Graph Class |
from_graph | ADFun Object Corresponding to a CppAD Graph |
to_graph | Create a C++ AD Graph Corresponding to an ADFun Object |