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}} }@)@
AD Binary Comparison Operators

b = x Op y

Compares two operands where one of the operands is an AD<Base> object. The comparison has the same interpretation as for the Base type.

The operator Op is one of the following:
Op   Meaning
< is x less than y
<= is x less than or equal y
> is x greater than y
>= is x greater than or equal y
== is x equal to y
!= is x not equal to y

The operand x has prototype
Type &x
where Type is AD<Base> , Base , or int.

The operand y has prototype
Type &y
where Type is AD<Base> , Base , or int.

The result b has type

Operation Sequence
The result of this operation is a bool value (not an AD of Base object). Thus it will not be recorded as part of an AD of Base operation sequence .

For example, suppose x and y are AD<Base> objects, the tape corresponding to AD<Base> is recording, b is true, and the subsequent code is
b )
y = cos(x);
y = sin(x);
only the assignment y = cos(x) is recorded on the tape (if x is a parameter , nothing is recorded). The CompareChange function can yield some information about changes in comparison operation results. You can use CondExp to obtain comparison operations that depends on the independent variable values with out re-taping the AD sequence of operations.

If one of the Op operators listed above is used with an AD<Base> object, it is assumed that the same operator is supported by the base type Base .

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