1 # ifndef CPPAD_LOCAL_OPTIMIZE_RECORD_CSUM_HPP
2 # define CPPAD_LOCAL_OPTIMIZE_RECORD_CSUM_HPP
20 namespace CppAD {
namespace local {
namespace optimize {
80 const Base* par = play->
GetPar();
87 size_t i_op = play->
var2op(current);
132 sum_par += par[arg[0]];
133 else sum_par -= par[arg[0]];
144 size_t( old2new[ play->
var2op(arg[0]) ].new_var) == 0
147 size_t i_op_tmp = play->
var2op(arg[0]);
172 sum_par -= par[arg[1]];
173 else sum_par += par[arg[1]];
187 size_t( old2new[ play->
var2op(arg[1]) ].new_var) == 0
190 size_t i_op_tmp = play->
var2op(arg[1]);
214 std::numeric_limits<addr_t>::max() >= n_add + n_sub
222 for(
size_t i = 0; i < n_add; i++)
225 new_arg = old2new[ play->
var2op(old_arg) ].new_var;
231 for(
size_t i = 0; i < n_sub; i++)
234 new_arg = old2new[ play->
var2op(old_arg) ].new_var;
This operator is only used once, it is a summation operator, and its parrent is a summation operator...
addr_t PutOp(OpCode op)
Put next operator in the operation sequence.
size_t num_par_rec(void) const
Fetch number of parameters in the recording.
Information about one old variable that is part of a new CSumOp operation.
The CppAD Simple Vector template class.
CPPAD_TAPE_ADDR_TYPE addr_t
Class used to store and play back an operation sequence recording.
Information about one cumulative summation operation.
std::stack< struct struct_csum_variable > op_stack
old operator indices for this cummulative summation
void PutArg(addr_t arg0)
Put one operation argument index in the recording.
Information that maps old an old operator to a new opeator and new variable.
OpCode op
Operator for which this old variable is the result, NumRes(op) > 0.
addr_t PutPar(const Base &par)
Find or add a parameter to the current vector of parameters.
OpCode
Type used to distinguish different AD< Base > atomic operations.
std::stack< size_t > sub_stack
old variavle indices to be subtracted
Class used to store an operation sequence while it is being recorded (the operation sequence is copie...
const addr_t * arg
Pointer to first argument (child) for this old operator. Set by the reverse sweep at beginning of opt...
void get_op_info(size_t op_index, OpCode &op, const addr_t *&op_arg, size_t &var_index) const
fetch the information corresponding to an operator
struct_size_pair record_csum(const player< Base > *play, const vector< struct_opt_op_info > &opt_op_info, const CppAD::vector< struct struct_old2new > &old2new, size_t current, recorder< Base > *rec, struct_csum_stacks &work)
Recording a cummulative cummulative summation.
size_t i_var
operator index for this variable
std::stack< size_t > add_stack
old variable indices to be added
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
size_t num_op_rec(void) const
Number of operators currently stored in the recording.
size_t var2op(size_t var_index) const
fetch the operator corresponding to a primary variable
Base GetPar(size_t i) const
Fetch a parameter from the recording.
bool add
Was this old variable added to the summation (if not it was subtracted)