# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
{xrst_begin CompareChange app}

Comparison Changes During Zero Order Forward Mode
#################################################

Syntax
******
| *c* = *f* . ``CompareChange`` ()

See Also
********
:ref:`FunCheck-name`

Deprecated 2015-01-20
*********************
This routine has been deprecated, use :ref:`compare_change-name`
instead.

Purpose
*******
We use :math:`F : \B{R}^n \rightarrow \B{R}^m` to denote the
:ref:`glossary@AD Function` corresponding to *f* .
This function may be not agree with the algorithm that was used
to create the corresponding
AD of *Base*
:ref:`operation sequence<glossary@Operation@Sequence>`
because of changes in AD
:ref:`comparison<Compare-name>` results.
The ``CompareChange`` function can be used to detect these changes.

f
*
The object *f* has prototype

   ``const ADFun`` < *Base* > *f*

c
*
The result *c* has prototype

   ``size_t`` *c*

It is the number of
``AD`` < *Base* > :ref:`comparison<Compare-name>`
operations,
corresponding to the previous call to :ref:`Forward-name`

   *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
:ref:`comparison operations<Compare-name>` corresponding to *x*
are different from when the
AD of *Base*
:ref:`operation sequence<glossary@Operation@Sequence>` was created.
In this case, you may want to re-tape the algorithm with the
:ref:`independent variables<glossary@Tape@Independent Variable>`
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 :ref:`forward_zero-name` .
If the functions values have not changed (see :ref:`FunCheck-name` )
it may not be worth re-taping a new AD operation sequence.

{xrst_end CompareChange}
