AD Boolean Functions
Keywords: ad boolean functions bool Cppad_bool_unary Cppad_bool_binary syntax purpose unary_name u x b create unary binary_name v y binary operation sequence example deprecated 2007-07-31

| Prev | Next |  |  |  |  |  |  |

AD Boolean Functions
Syntax
`CPPAD_BOOL_UNARY(Base, unary_name)
` `b = unary_name(u)
` `b = unary_name(x)
` `CPPAD_BOOL_BINARY(Base, binary_name)
` `b = binary_name(u, v)
` `b = binary_name(x, y)`
Purpose
Create a `bool` valued function that has `AD<Base>` arguments.
unary_name
This is the name of the `bool` valued function with one argument (as it is used in the source code). The user must provide a version of `unary_name` where the argument has type `Base` . CppAD uses this to create a version of `unary_name` where the argument has type `AD<Base>` .
u
The argument `u` has prototype `
const Base &u
` It is the value at which the user provided version of `unary_name` is to be evaluated. It is also used for the first argument to the user provided version of `binary_name` .
x
The argument `x` has prototype `
const AD<Base> &x
` It is the value at which the CppAD provided version of `unary_name` is to be evaluated. It is also used for the first argument to the CppAD provided version of `binary_name` .
b
The result `b` has prototype `
bool b
`
Create Unary
The preprocessor macro invocation `
CPPAD_BOOL_UNARY(Base, unary_name)
` defines the version of `unary_name` with a `AD<Base>` argument. This can with in a namespace (not the `CppAD` namespace) but must be outside of any routine.
binary_name
This is the name of the `bool` valued function with two arguments (as it is used in the source code). The user must provide a version of `binary_name` where the arguments have type `Base` . CppAD uses this to create a version of `binary_name` where the arguments have type `AD<Base>` .
v
The argument `v` has prototype `
const Base &v
` It is the second argument to the user provided version of `binary_name` .
y
The argument `x` has prototype `
const AD<Base> &y
` It is the second argument to the CppAD provided version of `binary_name` .
Create Binary
The preprocessor macro invocation `
CPPAD_BOOL_BINARY(Base, binary_name)
` defines the version of `binary_name` with `AD<Base>` arguments. This can with in a namespace (not the `CppAD` namespace) but must be outside of any routine.
Operation Sequence
The result of this operation is not an AD of Base object. Thus it will not be recorded as part of an AD of `Base` operation sequence .
Example
The file bool_fun.cpp contains an example and test of these operations. It returns true if it succeeds and false otherwise.
Deprecated 2007-07-31
The preprocessor symbols `CppADCreateUnaryBool` and `CppADCreateBinaryBool` are defined to be the same as `CPPAD_BOOL_UNARY` and `CPPAD_BOOL_BINARY` respectively (but their use is deprecated).

Input File: cppad/local/bool_fun.hpp