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}} }@)@
Check if Two Value are Identically Equal

b = EqualOpSeq(xy)

Determine if two x and y are identically equal; i.e., not only is x == y true, but if they are variables , they correspond have the same operation sequence .

Sometimes it is useful to cache information and only recalculate when a function's arguments change. In the case of AD variables, it may be important not only when the argument values are equal, but when they are related to the independent variables by the same operation sequence. After the assignment
y = x
these two AD objects would not only have equal values, but would also correspond to the same operation sequence.

The argument x has prototype
     const AD<
Base> &x

The argument y has prototype
     const AD<
Base> &y

The result b has prototype
The result is true if and only if one of the following cases holds:
  1. Both x and y are variables and correspond to the same operation sequence.
  2. Both x and y are parameters, Base is an AD type, and EqualOpSeq( Value(x) , Value(y) ) is true.
  3. Both x and y are parameters, Base is not an AD type, and x == y is true.

The file equal_op_seq.cpp contains an example and test of EqualOpSeq. It returns true if it succeeds and false otherwise.
Input File: cppad/core/equal_op_seq.hpp