00001 # ifndef CPPAD_BASE_ADOLC_INCLUDED
00002 # define CPPAD_BASE_ADOLC_INCLUDED
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 namespace CppAD {
00105 inline adouble CondExpOp(
00106 enum CppAD::CompareOp cop ,
00107 const adouble &left ,
00108 const adouble &right ,
00109 const adouble &trueCase ,
00110 const adouble &falseCase )
00111 { adouble result;
00112 switch( cop )
00113 {
00114 case CompareLt:
00115 condassign(result, right - left, trueCase, falseCase);
00116 break;
00117
00118 case CompareLe:
00119 condassign(result, left - right, falseCase, trueCase);
00120 break;
00121
00122 case CompareEq:
00123 condassign(result, left - right, falseCase, trueCase);
00124 condassign(result, right - left, falseCase, result);
00125 break;
00126
00127 case CompareGe:
00128 condassign(result, right - left, falseCase, trueCase);
00129 break;
00130
00131 case CompareGt:
00132 condassign(result, left - right, trueCase, falseCase);
00133 break;
00134
00135 default:
00136 CppAD::ErrorHandler::Call(
00137 true , __LINE__ , __FILE__ ,
00138 "CppAD::CondExp",
00139 "Error: for unknown reason."
00140 );
00141 result = trueCase;
00142 }
00143 return result;
00144 }
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 namespace CppAD {
00154 inline bool EqualOpSeq(const adouble &x, const adouble &y)
00155 { CppAD::ErrorHandler::Call(
00156 true , __LINE__ , __FILE__ ,
00157 "CppAD::EqualOpSeq(x, y)",
00158 "Error: adouble does not support EqualOpSeq."
00159 );
00160 return false;
00161 }
00162 }
00163
00164
00165
00166
00167
00168
00169
00170 namespace CppAD {
00171 inline bool IdenticalPar(const adouble &x)
00172 { return false; }
00173 inline bool IdenticalZero(const adouble &x)
00174 { return false; }
00175 inline bool IdenticalOne(const adouble &x)
00176 { return false; }
00177 inline bool IdenticalEqualPar(const adouble &x, const adouble &y)
00178 { return false; }
00179 }
00180
00181
00182
00183
00184 inline bool GreaterThanZero(const adouble &x)
00185 { return (x > 0); }
00186 inline bool GreaterThanOrZero(const adouble &x)
00187 { return (x >= 0); }
00188 inline bool LessThanZero(const adouble &x)
00189 { return (x < 0); }
00190 inline bool LessThanOrZero(const adouble &x)
00191 { return (x <= 0); }
00192
00193
00194
00195
00196 inline int Integer(const adouble &x)
00197 { return static_cast<int>( x.value() ); }
00198
00199
00200
00201 # endif