CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
template<class Base >
unsigned short CppAD::local::local_hash_code ( OpCode  op,
const addr_t *  arg,
size_t  npar,
const Base *  par 
)

Specialized hash code for a CppAD operator and its arguments.

Parameters
opis the operator that we are computing a hash code for. If it is not one of the following operartors, the operator is not hash coded and zero is returned:
  • unary operators: AbsOp, AcosOp, AcoshOp, AsinOp, AsinhOp, AtanOp, AtanhOp, CosOp, CoshOp ExpOp, Expm1Op, LogOp, Log1pOp, SinOp, SinhOp, SqrtOp, TanOp, TanhOp
  • binary operators where first argument is a parameter: AddpvOp, DivpvOp, MulpvOp, PowpvOp, SubpvOp, ZmulpvOp
  • binary operators where second argument is a parameter: DivvpOp, PowvpOp, SubvpOp, Zmulvp
  • binary operators where first is an index and second is a variable: DisOp
  • binary operators where both arguments are variables: AddvvOp, DivvvOp, MulvvOp, PowvvOp, SubvvOp, ZmulvvOp
Parameters
argis a vector of length NumArg(op) or 2 (which ever is smaller), containing the corresponding argument indices for this operator.
nparis the number of parameters corresponding to this operation sequence.
paris a vector of length npar containing the parameters for this operation sequence; i.e., given a parameter index of i, the corresponding parameter value is par[i].
Returns
is a hash code that is between zero and CPPAD_HASH_TABLE_SIZE - 1.
Checked Assertions
op must be one of the operators specified above. In addition,
  • std::numeric_limits<unsigned short>::max() >= CPPAD_HASH_TABLE_SIZE
  • sizeof(size_t) is even
  • sizeof(Base) is even
  • sizeof(unsigned short) == 2
  • size_t(op) < size_t(NumberOp) <= CPPAD_HASH_TABLE_SIZE
  • if the j-th argument for this operation is a parameter, arg[j] < npar.

Definition at line 122 of file local/hash_code.hpp.