00001 # ifndef CPPAD_DEFINE_INCLUDED
00002 # define CPPAD_DEFINE_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
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 # ifndef CPPAD_NULL
00124 # define CPPAD_NULL 0
00125 # endif
00126
00127 # ifndef CPPAD_MAX_NUM_THREADS
00128 # ifdef _OPENMP
00129 # define CPPAD_MAX_NUM_THREADS 32
00130 # else
00131 # define CPPAD_MAX_NUM_THREADS 1
00132 # endif
00133 # endif
00134
00135
00136 # define CPPAD_FOLD_ASSIGNMENT_OPERATOR(Op) \
00137 \
00138 template <class Base> \
00139 inline AD<Base>& operator Op \
00140 (AD<Base> &left, double right) \
00141 { return left Op AD<Base>(right); } \
00142 \
00143 template <class Base> \
00144 inline AD<Base>& operator Op \
00145 (AD<Base> &left, const Base &right) \
00146 { return left Op AD<Base>(right); } \
00147 \
00148 inline AD<double>& operator Op \
00149 (AD<double> &left, const double &right) \
00150 { return left Op AD<double>(right); } \
00151 \
00152 template <class Base> \
00153 inline AD<Base>& operator Op \
00154 (AD<Base> &left, const VecAD_reference<Base> &right) \
00155 { return left Op right.ADBase(); }
00156
00157
00158
00159 # define CPPAD_FOLD_AD_VALUED_BINARY_OPERATOR(Op) \
00160 \
00161 \
00162 \
00163 template <class Base> \
00164 inline AD<Base> operator Op \
00165 (const AD<Base> &left, const VecAD_reference<Base> &right) \
00166 { return left Op right.ADBase(); } \
00167 \
00168 template <class Base> \
00169 inline AD<Base> operator Op \
00170 (const VecAD_reference<Base> &left, const VecAD_reference<Base> &right)\
00171 { return left.ADBase() Op right.ADBase(); } \
00172 \
00173 template <class Base> \
00174 inline AD<Base> operator Op \
00175 (const VecAD_reference<Base> &left, const AD<Base> &right) \
00176 { return left.ADBase() Op right; } \
00177 \
00178 \
00179 \
00180 template <class Base> \
00181 inline AD<Base> operator Op \
00182 (const Base &left, const AD<Base> &right) \
00183 { return AD<Base>(left) Op right; } \
00184 \
00185 template <class Base> \
00186 inline AD<Base> operator Op \
00187 (const Base &left, const VecAD_reference<Base> &right) \
00188 { return AD<Base>(left) Op right.ADBase(); } \
00189 \
00190 template <class Base> \
00191 inline AD<Base> operator Op \
00192 (const AD<Base> &left, const Base &right) \
00193 { return left Op AD<Base>(right); } \
00194 \
00195 template <class Base> \
00196 inline AD<Base> operator Op \
00197 (const VecAD_reference<Base> &left, const Base &right) \
00198 { return left.ADBase() Op AD<Base>(right); } \
00199 \
00200 \
00201 \
00202 \
00203 template <class Base> \
00204 inline AD<Base> operator Op \
00205 (const double &left, const AD<Base> &right) \
00206 { return AD<Base>(left) Op right; } \
00207 \
00208 template <class Base> \
00209 inline AD<Base> operator Op \
00210 (const double &left, const VecAD_reference<Base> &right) \
00211 { return AD<Base>(left) Op right.ADBase(); } \
00212 \
00213 template <class Base> \
00214 inline AD<Base> operator Op \
00215 (const AD<Base> &left, const double &right) \
00216 { return left Op AD<Base>(right); } \
00217 \
00218 template <class Base> \
00219 inline AD<Base> operator Op \
00220 (const VecAD_reference<Base> &left, const double &right) \
00221 { return left.ADBase() Op AD<Base>(right); } \
00222 \
00223 \
00224 \
00225 inline AD<double> operator Op \
00226 (const double &left, const AD<double> &right) \
00227 { return AD<double>(left) Op right; } \
00228 \
00229 inline AD<double> operator Op \
00230 (const double &left, const VecAD_reference<double> &right) \
00231 { return AD<double>(left) Op right.ADBase(); } \
00232 \
00233 inline AD<double> operator Op \
00234 (const AD<double> &left, const double &right) \
00235 { return left Op AD<double>(right); } \
00236 \
00237 inline AD<double> operator Op \
00238 (const VecAD_reference<double> &left, const double &right) \
00239 { return left.ADBase() Op AD<double>(right); }
00240
00241
00242
00243
00244 # define CPPAD_FOLD_BOOL_VALUED_BINARY_OPERATOR(Op) \
00245 \
00246 \
00247 \
00248 template <class Base> \
00249 inline bool operator Op \
00250 (const AD<Base> &left, const VecAD_reference<Base> &right) \
00251 { return left Op right.ADBase(); } \
00252 \
00253 template <class Base> \
00254 inline bool operator Op \
00255 (const VecAD_reference<Base> &left, const VecAD_reference<Base> &right)\
00256 { return left.ADBase() Op right.ADBase(); } \
00257 \
00258 template <class Base> \
00259 inline bool operator Op \
00260 (const VecAD_reference<Base> &left, const AD<Base> &right) \
00261 { return left.ADBase() Op right; } \
00262 \
00263 \
00264 \
00265 template <class Base> \
00266 inline bool operator Op \
00267 (const Base &left, const AD<Base> &right) \
00268 { return AD<Base>(left) Op right; } \
00269 \
00270 template <class Base> \
00271 inline bool operator Op \
00272 (const Base &left, const VecAD_reference<Base> &right) \
00273 { return AD<Base>(left) Op right.ADBase(); } \
00274 \
00275 template <class Base> \
00276 inline bool operator Op \
00277 (const AD<Base> &left, const Base &right) \
00278 { return left Op AD<Base>(right); } \
00279 \
00280 template <class Base> \
00281 inline bool operator Op \
00282 (const VecAD_reference<Base> &left, const Base &right) \
00283 { return left.ADBase() Op AD<Base>(right); } \
00284 \
00285 \
00286 \
00287 \
00288 template <class Base> \
00289 inline bool operator Op \
00290 (const double &left, const AD<Base> &right) \
00291 { return AD<Base>(left) Op right; } \
00292 \
00293 template <class Base> \
00294 inline bool operator Op \
00295 (const double &left, const VecAD_reference<Base> &right) \
00296 { return AD<Base>(left) Op right.ADBase(); } \
00297 \
00298 template <class Base> \
00299 inline bool operator Op \
00300 (const AD<Base> &left, const double &right) \
00301 { return left Op AD<Base>(right); } \
00302 \
00303 template <class Base> \
00304 inline bool operator Op \
00305 (const VecAD_reference<Base> &left, const double &right) \
00306 { return left.ADBase() Op AD<Base>(right); } \
00307 \
00308 \
00309 \
00310 inline bool operator Op \
00311 (const double &left, const AD<double> &right) \
00312 { return AD<double>(left) Op right; } \
00313 \
00314 inline bool operator Op \
00315 (const double &left, const VecAD_reference<double> &right) \
00316 { return AD<double>(left) Op right.ADBase(); } \
00317 \
00318 inline bool operator Op \
00319 (const AD<double> &left, const double &right) \
00320 { return left Op AD<double>(right); } \
00321 \
00322 inline bool operator Op \
00323 (const VecAD_reference<double> &left, const double &right) \
00324 { return left.ADBase() Op AD<double>(right); }
00325
00326 # endif