00001 # ifndef CPPAD_BASE_COMPLEX_INCLUDED
00002 # define CPPAD_BASE_COMPLEX_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 namespace CppAD {
00064 inline std::complex<double> CondExpOp(
00065 enum CppAD::CompareOp cop ,
00066 const std::complex<double> &left ,
00067 const std::complex<double> &right ,
00068 const std::complex<double> &trueCase ,
00069 const std::complex<double> &falseCase )
00070 { CppAD::ErrorHandler::Call(
00071 true , __LINE__ , __FILE__ ,
00072 "std::complex<float> CondExpOp(...)",
00073 "Error: cannot use CondExp with a complex type"
00074 );
00075 return std::complex<double>(0);
00076 }
00077 }
00078
00079
00080
00081
00082
00083
00084 namespace CppAD {
00085 inline bool EqualOpSeq(
00086 const std::complex<double> &x ,
00087 const std::complex<double> &y )
00088 { return x == y;
00089 }
00090 }
00091
00092
00093
00094
00095
00096
00097 namespace CppAD {
00098 inline bool IdenticalPar(const std::complex<double> &x)
00099 { return true; }
00100 inline bool IdenticalZero(const std::complex<double> &x)
00101 { return (x == std::complex<double>(0., 0.) ); }
00102 inline bool IdenticalOne(const std::complex<double> &x)
00103 { return (x == std::complex<double>(1., 0.) ); }
00104 inline bool IdenticalEqualPar(
00105 const std::complex<double> &x, const std::complex<double> &y)
00106 { return (x == y); }
00107 }
00108
00109
00110
00111
00112
00113 namespace CppAD {
00114 inline bool GreaterThanZero(const std::complex<double> &x)
00115 { CppAD::ErrorHandler::Call(
00116 true , __LINE__ , __FILE__ ,
00117 "GreaterThanZero(x)",
00118 "Error: cannot use GreaterThanZero with complex"
00119 );
00120 return false;
00121 }
00122 inline bool GreaterThanOrZero(const std::complex<double> &x)
00123 { CppAD::ErrorHandler::Call(
00124 true , __LINE__ , __FILE__ ,
00125 "GreaterThanZero(x)",
00126 "Error: cannot use GreaterThanZero with complex"
00127 );
00128 return false;
00129 }
00130 inline bool LessThanZero(const std::complex<double> &x)
00131 { CppAD::ErrorHandler::Call(
00132 true , __LINE__ , __FILE__ ,
00133 "LessThanZero(x)",
00134 "Error: cannot use LessThanZero with complex"
00135 );
00136 return false;
00137 }
00138 inline bool LessThanOrZero(const std::complex<double> &x)
00139 { CppAD::ErrorHandler::Call(
00140 true , __LINE__ , __FILE__ ,
00141 "LessThanZero(x)",
00142 "Error: cannot use LessThanZero with complex"
00143 );
00144 return false;
00145 }
00146 }
00147
00148
00149
00150
00151
00152
00153
00154 namespace CppAD {
00155 inline int Integer(const std::complex<double> &x)
00156 { return static_cast<int>( x.real() ); }
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 # define CPPAD_INVALID_COMPLEX_CASE(function) \
00180 inline std::complex<double> function(const std::complex<double> &x) \
00181 { CppAD::ErrorHandler::Call( \
00182 true , __LINE__ , __FILE__ , \
00183 "std::complex<double>", \
00184 "Error: cannot use " #function " with a complex type" \
00185 ); \
00186 return std::complex<double>(0); \
00187 }
00188 namespace CppAD {
00189 CPPAD_INVALID_COMPLEX_CASE(abs)
00190 CPPAD_INVALID_COMPLEX_CASE(acos)
00191 CPPAD_INVALID_COMPLEX_CASE(asin)
00192 CPPAD_INVALID_COMPLEX_CASE(atan)
00193 CPPAD_INVALID_COMPLEX_CASE(erf)
00194 }
00195 # undef CPPAD_INVALID_COMPLEX_CASE
00196
00197
00198
00199 # define CPPAD_INVALID_COMPLEX_CASE(function) \
00200 inline std::complex<float> function(const std::complex<float> &x) \
00201 { CppAD::ErrorHandler::Call( \
00202 true , __LINE__ , __FILE__ , \
00203 "std::complex<float>", \
00204 "Error: cannot use " #function " with a complex type" \
00205 ); \
00206 return std::complex<float>(0); \
00207 }
00208 namespace CppAD {
00209
00210 inline std::complex<float> CondExpOp(
00211 enum CppAD::CompareOp cop ,
00212 const std::complex<float> &left ,
00213 const std::complex<float> &right ,
00214 const std::complex<float> &trueCase ,
00215 const std::complex<float> &falseCase )
00216 { CppAD::ErrorHandler::Call(
00217 true , __LINE__ , __FILE__ ,
00218 "std::complex<float> CondExpOp(...)",
00219 "Error: cannot use CondExp with a complex type"
00220 );
00221 return std::complex<float>(0);
00222 }
00223
00224 inline bool EqualOpSeq(
00225 const std::complex<float> &x ,
00226 const std::complex<float> &y )
00227 { return x == y;
00228 }
00229
00230 inline bool IdenticalPar(const std::complex<float> &x)
00231 { return true; }
00232 inline bool IdenticalZero(const std::complex<float> &x)
00233 { return (x == std::complex<float>(0., 0.) ); }
00234 inline bool IdenticalOne(const std::complex<float> &x)
00235 { return (x == std::complex<float>(1., 0.) ); }
00236 inline bool IdenticalEqualPar(
00237 const std::complex<float> &x, const std::complex<float> &y)
00238 { return (x == y); }
00239
00240 inline bool GreaterThanZero(const std::complex<float> &x)
00241 { CppAD::ErrorHandler::Call(
00242 true , __LINE__ , __FILE__ ,
00243 "GreaterThanZero(x)",
00244 "Error: cannot use GreaterThanZero with complex"
00245 );
00246 return false;
00247 }
00248 inline bool GreaterThanOrZero(const std::complex<float> &x)
00249 { CppAD::ErrorHandler::Call(
00250 true , __LINE__ , __FILE__ ,
00251 "GreaterThanOrZero(x)",
00252 "Error: cannot use GreaterThanOrZero with complex"
00253 );
00254 return false;
00255 }
00256 inline bool LessThanZero(const std::complex<float> &x)
00257 { CppAD::ErrorHandler::Call(
00258 true , __LINE__ , __FILE__ ,
00259 "LessThanZero(x)",
00260 "Error: cannot use LessThanZero with complex"
00261 );
00262 return false;
00263 }
00264 inline bool LessThanOrZero(const std::complex<float> &x)
00265 { CppAD::ErrorHandler::Call(
00266 true , __LINE__ , __FILE__ ,
00267 "LessThanOrZero(x)",
00268 "Error: cannot use LessThanOrZero with complex"
00269 );
00270 return false;
00271 }
00272
00273 inline int Integer(const std::complex<float> &x)
00274 { return static_cast<int>( x.real() ); }
00275
00276 CPPAD_INVALID_COMPLEX_CASE(abs)
00277 CPPAD_INVALID_COMPLEX_CASE(acos)
00278 CPPAD_INVALID_COMPLEX_CASE(asin)
00279 CPPAD_INVALID_COMPLEX_CASE(atan)
00280 CPPAD_INVALID_COMPLEX_CASE(erf)
00281 }
00282 # undef CPPAD_INVALID_COMPLEX_CASE
00283
00284 # endif