Prev Next base_identical

@(@\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}} }@)@
Base Type Requirements for Identically Equal Comparisons

EqualOpSeq
If function EqualOpSeq is used with arguments of type AD<Base> , the type Base must support the syntax
     
b = CppAD::EqualOpSeq(uv)
This should return true if and only if u is identically equal to v and it makes no different which one is used. The arguments u and v have prototype
     const 
Baseu
     const 
Basev
The return value b has prototype
     bool 
b

The Simple Case
If Base is a relatively simple type, the EqualOpSeq function can be defined by
namespace CppAD {
     inline 
Base EqualOpSeq(const Base& u, const Base& v)
     {    return u == v; }
}
For example, see base_alloc .

More Complicated Cases
The variables u and v are not identically equal in the following case (which CppAD automatically defines EqualOpSeq for): The type Base is AD<double> , x[0] = x[1] = 1. , then independent is used to make x the independent variable vector, and then u = x[0] , v = x[1] , Note that during a future Forward calculation, u and v could correspond to different values. For example, see adolc EqualOpSeq .

Identical

IdenticalPar
A Base is a parameter when used in an AD<Base> operation sequence. It is however still possible for a parameter to change its value. For example, the Base value u is not identically a parameter equal in the following case (which CppAD automatically defines IdenticalPar for): The type Base is AD<double> , x[0] = 1. , then independent is used to make x the independent variable vector, and then u = x[0] , Note that during a future Forward calculation, u could correspond to different values.

Prototypes
The argument u has prototype
     const 
Base u
If it is present, the argument v has prototype
     const 
Base v
The result b has prototype
     bool 
b

Identical Functions
The type Base must support the following functions (in the CppAD namespace):
Syntax Result
b = IdenticalPar(u)    the Base value will always be the same
b = IdenticalZero(u)    u equals zero and IdenticalPar(u)
b = IdenticalOne(u)    u equals one and IdenticalPar(u)
b = IdenticalEqualPar(uv)    u equals v , IdenticalPar(u) and IdenticalPar(v)

Examples
See base_alloc .
Input File: omh/base_require/base_identical.omh