Prev | Next |
f.compare_change_count(count)
number = f.compare_change_number()
op_index = f.compare_change_op_index()
See Also
FunCheck
f
; i.e,
given @(@
x \in \B{R}^n
@)@, @(@
F(x)
@)@ is defined by
F(x) = f.Forward(0, x)
see forward_zero
.
If @(@
x
@)@ is such that
all the algorithm comparison
operations
have the same result as when the algorithm was taped,
The function @(@
F(x)
@)@ and the algorithm will have the same values.
(This is a sufficient, but not necessary condition).
compare_change_number
and compare_change_op_index
syntax, the object
f
has prototype
const ADFun<Base> f
In the compare_change_count
syntax, the object
f
has prototype
ADFun<Base> f
count
has prototype
size_t count
It specifies which comparison change should correspond to the
information stored in
f
during subsequent calls to
forward_zero
; i.e.,
f.Forward(0, x)
For example, if
count == 1
,
the operator index corresponding to the first comparison change
will be stored.
This is the default value used if
count
is not specified.
count == 0
, should be faster because
the comparisons are not checked during
f.Forward(0, x)
number
has prototype
size_t number
If
count
is non-zero,
number
is the number of
AD<Base>
comparison
operations,
corresponding to the previous call to
f.Forward(0, x)
that have a different result for this value of
x
than the value used when
f
was created by taping an algorithm.
If
count
is zero,
or if no calls to
f.Forward(0, x)
follow the previous
setting of
count
,
number
is zero.
count
and
number
are non-zero,
you may want to re-tape the algorithm with the
independent variables
equal to the values in
x
,
so the 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 forward_zero
.
If the functions values have not changed (see FunCheck
)
it may not be worth re-taping a new AD operation sequence.
op_index
has prototype
size_t op_index
If
count
is non-zero,
op_index
is the operator index corresponding the
count
-th comparison change during the previous call to
f.Forward(0, x)
If
count
is greater than the corresponding
number
, there is no such comparison change and
op_index
will also be zero.
If
count
is zero,
if the function
f
has been optimized
,
or if no calls to
f.Forward(0, x)
follow the previous
setting of
count
,
op_index
is zero.
Independent(x, abort_op_index)