/home/coin/SVN-release/CoinAll-1.1.0/cppad/cppad/local/bool_fun.hpp

Go to the documentation of this file.
00001 # ifndef CPPAD_BOOL_FUN_INCLUDED
00002 # define CPPAD_BOOL_FUN_INCLUDED
00003 
00004 /* --------------------------------------------------------------------------
00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
00006 
00007 CppAD is distributed under multiple licenses. This distribution is under
00008 the terms of the 
00009                     Common Public License Version 1.0.
00010 
00011 A copy of this license is included in the COPYING file of this distribution.
00012 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
00013 -------------------------------------------------------------------------- */
00014 
00015 /*
00016 $begin BoolFun$$
00017 $spell
00018         namespace
00019         bool
00020         CppAD
00021         const
00022 $$
00023 
00024 $index bool, AD function$$
00025 $index function, AD bool$$
00026 $index unary, AD bool$$
00027 $index binary, AD bool$$
00028 
00029 $section AD Boolean Functions$$
00030 
00031 $head Syntax$$
00032 $syntax%CPPAD_BOOL_UNARY(%Base%, %unary_name%)
00033 %$$
00034 $syntax%%b% = %unary_name%(%u%)
00035 %$$
00036 $syntax%%b% = %unary_name%(%x%)
00037 %$$
00038 $syntax%CPPAD_BOOL_BINARY(%Base%, %binary_name%)
00039 %$$
00040 $syntax%%b% = %binary_name%(%u%, %v%)
00041 %$$
00042 $syntax%%b% = %binary_name%(%x%, %y%)%$$
00043 
00044 
00045 $head Purpose$$
00046 Create a $code bool$$ valued function that has $syntax%AD<%Base%>%$$ arguments.
00047 
00048 $head unary_name$$
00049 This is the name of the $code bool$$ valued function with one argument
00050 (as it is used in the source code).
00051 The user must provide a version of $italic unary_name$$ where
00052 the argument has type $italic Base$$.
00053 CppAD uses this to create a version of $italic unary_name$$ where the
00054 argument has type $syntax%AD<%Base%>%$$.
00055 
00056 $head u$$
00057 The argument $italic u$$ has prototype
00058 $syntax%
00059         const %Base% &%u%
00060 %$$
00061 It is the value at which the user provided version of $italic unary_name$$
00062 is to be evaluated.
00063 It is also used for the first argument to the 
00064 user provided version of $italic binary_name$$.
00065 
00066 $head x$$
00067 The argument $italic x$$ has prototype
00068 $syntax%
00069         const AD<%Base%> &%x%
00070 %$$
00071 It is the value at which the CppAD provided version of $italic unary_name$$
00072 is to be evaluated.
00073 It is also used for the first argument to the 
00074 CppAD provided version of $italic binary_name$$.
00075 
00076 $head b$$
00077 The result $italic b$$ has prototype
00078 $syntax%
00079         bool %b%
00080 %$$
00081 
00082 $head Create Unary$$
00083 $index CPPAD_BOOL_UNARY$$
00084 The preprocessor macro invocation
00085 $syntax%
00086         CPPAD_BOOL_UNARY(%Base%, %unary_name%)
00087 %$$
00088 defines the version of $italic unary_name$$ with a $syntax%AD<%Base%>%$$
00089 argument.
00090 This can with in a namespace 
00091 (not the $code CppAD$$ namespace)
00092 but must be outside of any routine.
00093 
00094 $head binary_name$$
00095 This is the name of the $code bool$$ valued function with two arguments
00096 (as it is used in the source code).
00097 The user must provide a version of $italic binary_name$$ where
00098 the arguments have type $italic Base$$.
00099 CppAD uses this to create a version of $italic binary_name$$ where the
00100 arguments have type $syntax%AD<%Base%>%$$.
00101 
00102 $head v$$
00103 The argument $italic v$$ has prototype
00104 $syntax%
00105         const %Base% &%v%
00106 %$$
00107 It is the second argument to
00108 the user provided version of $italic binary_name$$.
00109 
00110 $head y$$
00111 The argument $italic x$$ has prototype
00112 $syntax%
00113         const AD<%Base%> &%y%
00114 %$$
00115 It is the second argument to
00116 the CppAD provided version of $italic binary_name$$.
00117 
00118 $head Create Binary$$
00119 $index CPPAD_BOOL_BINARY$$
00120 The preprocessor macro invocation
00121 $syntax%
00122         CPPAD_BOOL_BINARY(%Base%, %binary_name%)
00123 %$$
00124 defines the version of $italic binary_name$$ with $syntax%AD<%Base%>%$$
00125 arguments.
00126 This can with in a namespace 
00127 (not the $code CppAD$$ namespace)
00128 but must be outside of any routine.
00129 
00130 
00131 $head Operation Sequence$$
00132 The result of this operation is not an
00133 $xref/glossary/AD of Base/AD of Base/$$ object.
00134 Thus it will not be recorded as part of an
00135 AD of $italic Base$$
00136 $xref/glossary/Operation/Sequence/operation sequence/1/$$.
00137 
00138 $head Example$$
00139 $children%
00140         example/bool_fun.cpp
00141 %$$
00142 The file
00143 $xref/BoolFun.cpp/$$
00144 contains an example and test of these operations.
00145 It returns true if it succeeds and false otherwise.
00146 
00147 $head Deprecated$$
00148 The preprocessor symbols $code CppADCreateUnaryBool$$ 
00149 and $code CppADCreateBinaryBool$$ are defined to be the same as
00150 $code CPPAD_BOOL_UNARY$$ and $code CPPAD_BOOL_BINARY$$ respectively
00151 (but their use is deprecated).
00152 
00153 $end
00154 */
00155 
00156 # include <cppad/local/bool_fun_link.hpp>
00157 
00158 # define CPPAD_BOOL_UNARY(Base, unary_name)                        \
00159         inline bool unary_name (const CppAD::AD<Base> &x)          \
00160         {                                                          \
00161                 return CppAD::AD<Base>::UnaryBool(unary_name, x);               \
00162         }
00163 
00164 # define CPPAD_BOOL_BINARY(Base, binary_name)                         \
00165         inline bool binary_name (                                     \
00166                 const CppAD::AD<Base> &x, const CppAD::AD<Base> &y)   \
00167         {                                                             \
00168                 return CppAD::AD<Base>::BinaryBool(binary_name, x, y);\
00169         }
00170 
00171 # define CppADCreateUnaryBool  CPPAD_BOOL_UNARY
00172 # define CppADCreateBinaryBool CPPAD_BOOL_BINARY
00173 
00174 
00175 # endif

Generated on Sun Nov 14 14:06:33 2010 for Coin-All by  doxygen 1.4.7