Purpose
We use F : B^n \rightarrow B^m
to denote the
AD function
corresponding to f.
This function may be not agree with the algorithm that was used
to create the corresponding
AD of Baseoperation sequence
because of changes in AD
comparison
results.
The CompareChange function can be used to detect these changes.
c
The result c has prototype
size_t c It is the number of
AD<Base>comparison
operations,
corresponding to the previous call to Forward f.Forward(0, x) that have a different result from
when F was created by taping an algorithm.
Discussion
If c is not zero,
the boolean values resulting from some of the
comparison operations
corresponding to x
are different from when the
AD of Baseoperation sequence
was created.
In this case, you may want to re-tape the algorithm with the
independent variables
equal to the values in x
(so AD operation sequence properly represents the algorithm
for this value of independent variables).
On the other hand, re-taping the AD operation sequence usually takes
significantly more time than evaluation using ForwardZero
.
If the functions values have not changed (see FunCheck
)
it may not be worth re-taping a new AD operation sequence.
Restrictions
Computation of this function requires extra operations in the tape.
If NDEBUG is defined,
these operations are not included in the tape and
Example
The file
CompareChange.cpp
contains an example and test of this operation.
They return true if they succeed and false otherwise.
Input File: omh/forward.omh