CppAD: A C++ Algorithmic Differentiation Package
20171217
|
void CppAD::local::optimize::match_op | ( | const player< Base > * | play, |
vector< struct_opt_op_info > & | opt_op_info, | ||
size_t | current, | ||
sparse_list & | hash_table_op | ||
) |
Search for a previous operator that matches the current one.
If an argument for the current operator is a variable, and the argument has previous match, the previous match for the argument is used when checking for a match for the current operator.
play | This is the old operation sequence. |
opt_op_info | Mapping from operator index to operator information. The input value of opt_op_info[current].previous is assumed to be zero. If a match if found, the output value of opt_op_info[current].previous is set to the matching operator index, otherwise it is left as is. Note that opt_op_info[current].previous < current. |
current | is the index of the current operator which must be an unary or binary operator. Note that NumArg(ErfOp) == 3 but it is effectivey a unary operator and is allowed otherwise NumArg( opt_op_info[current].op) < 3. It is assumed that hash_table_op is initialized as a vector of emtpy sets. After this initialization, the value of current inceases with each call to match_op. |
hash_table_op | is a vector of sets, hash_table_op.n_set() == CPPAD_HASH_TABLE_SIZE and hash_table_op.end() == opt_op_info.size(). If i_op is an element of set[j], then the operation opt_op_info[i_op] has hash code j, and opt_op_info[i_op] does not match any other element of set[j]. An entry will be added each time match_op is called and a match for the current operator is not found. |
Definition at line 69 of file match_op.hpp.
Referenced by get_opt_op_info().