00001 # ifndef CPPAD_ORDERED_INCLUDED 00002 # define CPPAD_ORDERED_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 --------------------------------------------------------------------------- 00017 $begin GreaterThanZero$$ $comment CppAD Developer Documentation$$ 00018 $spell 00019 inline 00020 const 00021 bool 00022 $$ 00023 00024 $index >$$ 00025 $index GreaterThanZero$$ 00026 $index positive$$ 00027 $section Check if a Value is Greater Than Zero$$ 00028 00029 $head Syntax$$ 00030 $syntax%inline bool GreaterThanZero(const %Type% &%x%)%$$ 00031 00032 $head Description$$ 00033 If $italic Type$$ is $syntax%AD<%Base%>%$$ for some $italic Base$$, 00034 $italic x$$ is greater than zero if and only if 00035 $syntax%%x%.value_%$$ is greater than zero. 00036 If $italic Type$$ is not $syntax%AD<%Base%>%$$ for some $italic Base$$, 00037 $italic x$$ is greater than zero if and only if 00038 $syntax% 00039 %x% > 0. 00040 %$$ 00041 00042 $end 00043 --------------------------------------------------------------------------- 00044 $begin GreaterThanOrZero$$ $comment CppAD Developer Documentation$$ 00045 $spell 00046 inline 00047 const 00048 bool 00049 $$ 00050 00051 $index >=$$ 00052 $index GreaterThanOrZero$$ 00053 $index positive$$ 00054 $section Check if a Value is Greater Than Or Equal Zero$$ 00055 00056 $head Syntax$$ 00057 $syntax%inline bool GreaterThanZero(const %Type% &%x%)%$$ 00058 00059 $head Description$$ 00060 If $italic Type$$ is $syntax%AD<%Base%>%$$ for some $italic Base$$, 00061 $italic x$$ is greater than or equal zero if and only if 00062 $syntax%%x%.value_%$$ is greater than zero. 00063 If $italic Type$$ is not $syntax%AD<%Base%>%$$ for some $italic Base$$, 00064 $italic x$$ is greater than zero if and only if 00065 $syntax% 00066 %x% >= 0. 00067 %$$ 00068 00069 $end 00070 --------------------------------------------------------------------------- 00071 $begin LessThanZero$$ $comment CppAD Developer Documentation$$ 00072 $spell 00073 inline 00074 const 00075 bool 00076 $$ 00077 00078 $index >$$ 00079 $index LessThanZero$$ 00080 $index negative$$ 00081 $section Check if a Value is Less Than Zero$$ 00082 00083 $head Syntax$$ 00084 $syntax%inline bool LessThanZero(const %Type% &%x%)%$$ 00085 00086 $head Description$$ 00087 If $italic Type$$ is $syntax%AD<%Base%>%$$ for some $italic Base$$, 00088 $italic x$$ is less than zero if and only if 00089 $syntax%%x%.value_%$$ is less than zero. 00090 If $italic Type$$ is not $syntax%AD<%Base%>%$$ for some $italic Base$$, 00091 $italic x$$ is less than zero if and only if 00092 $syntax% 00093 %x% < 0. 00094 %$$ 00095 00096 $end 00097 --------------------------------------------------------------------------- 00098 $begin LessThanOrZero$$ $comment CppAD Developer Documentation$$ 00099 $spell 00100 inline 00101 const 00102 bool 00103 $$ 00104 00105 $index >=$$ 00106 $index LessThanOrZero$$ 00107 $index negative$$ 00108 $section Check if a Value is Less Than Or Equal Zero$$ 00109 00110 $head Syntax$$ 00111 $syntax%inline bool LessThanOrZero(const %Type% &%x%)%$$ 00112 00113 $head Description$$ 00114 If $italic Type$$ is $syntax%AD<%Base%>%$$ for some $italic Base$$, 00115 $italic x$$ is less than or equal zero if and only if 00116 $syntax%%x%.value_%$$ is less than zero. 00117 If $italic Type$$ is not $syntax%AD<%Base%>%$$ for some $italic Base$$, 00118 $italic x$$ is less than or equal zero if and only if 00119 $syntax% 00120 %x% <= 0. 00121 %$$ 00122 00123 $end 00124 ------------------------------------------------------------------------------ 00125 */ 00126 00127 00128 namespace CppAD { // BEGIN CppAD namespace 00129 00130 // GreaterThanZero ------------------------------------------------------------ 00131 inline bool GreaterThanZero(const float &x) 00132 { return x > 0.; } 00133 00134 inline bool GreaterThanZero(const double &x) 00135 { return x > 0.; } 00136 00137 template <class Base> 00138 inline bool GreaterThanZero(const AD<Base> &x) 00139 { return GreaterThanZero(x.value_); } 00140 00141 00142 // GreaterThanOrZero --------------------------------------------------------- 00143 inline bool GreaterThanOrZero(const float &x) 00144 { return x >= 0.; } 00145 00146 inline bool GreaterThanOrZero(const double &x) 00147 { return x >= 0.; } 00148 00149 template <class Base> 00150 inline bool GreaterThanOrZero(const AD<Base> &x) 00151 { return GreaterThanOrZero(x.value_); } 00152 00153 00154 // LessThanZero ------------------------------------------------------------ 00155 00156 inline bool LessThanZero(const float &x) 00157 { return x < 0.; } 00158 00159 inline bool LessThanZero(const double &x) 00160 { return x < 0.; } 00161 00162 template <class Base> 00163 inline bool LessThanZero(const AD<Base> &x) 00164 { return LessThanZero(x.value_); } 00165 00166 // LessThanOrZero ------------------------------------------------------------ 00167 00168 inline bool LessThanOrZero(const float &x) 00169 { return x <= 0.; } 00170 00171 inline bool LessThanOrZero(const double &x) 00172 { return x <= 0.; } 00173 00174 template <class Base> 00175 inline bool LessThanOrZero(const AD<Base> &x) 00176 { return LessThanOrZero(x.value_); } 00177 00178 } // END CppAD namespace 00179 00180 # endif 00181