\(\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}} }\)
bool_fun¶
View page sourceAD Boolean Functions¶
Syntax¶
CPPAD_BOOL_UNARY
( Base , unary_name )CPPAD_BOOL_BINARY
( Base , binary_name )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.
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).