numerix_doc 0.4
|
00001 00002 #include <basix/double.hpp> 00003 #include <numerix/integer.hpp> 00004 #include <numerix/rational.hpp> 00005 #include <numerix/complex.hpp> 00006 #include <numerix/complex_double.hpp> 00007 #include <basix/glue.hpp> 00008 00009 #define double_literal(x) as_double (as_string (x)) 00010 00011 namespace mmx { 00012 static complex<double> 00013 GLUE_1 (const double &arg_1) { 00014 return complex<double > (arg_1); 00015 } 00016 00017 static complex<double> 00018 GLUE_2 (const double &arg_1, const double &arg_2) { 00019 return complex<double > (arg_1, arg_2); 00020 } 00021 00022 static complex<double> 00023 GLUE_3 (const double &arg_1) { 00024 return complex<double > (arg_1); 00025 } 00026 00027 static double 00028 GLUE_4 (const complex<double> &arg_1) { 00029 return Re (arg_1); 00030 } 00031 00032 static double 00033 GLUE_5 (const complex<double> &arg_1) { 00034 return Im (arg_1); 00035 } 00036 00037 static complex<double> 00038 GLUE_6 (const complex<double> &arg_1) { 00039 return conj (arg_1); 00040 } 00041 00042 static complex<double> 00043 GLUE_7 (const complex<double> &arg_1) { 00044 return times_i (arg_1); 00045 } 00046 00047 static complex<double> 00048 GLUE_8 (const complex<double> &arg_1) { 00049 return over_i (arg_1); 00050 } 00051 00052 static complex<double> 00053 GLUE_9 (const complex<double> &arg_1) { 00054 return -arg_1; 00055 } 00056 00057 static complex<double> 00058 GLUE_10 (const complex<double> &arg_1) { 00059 return square (arg_1); 00060 } 00061 00062 static complex<double> 00063 GLUE_11 (const complex<double> &arg_1, const complex<double> &arg_2) { 00064 return arg_1 + arg_2; 00065 } 00066 00067 static complex<double> 00068 GLUE_12 (const complex<double> &arg_1, const complex<double> &arg_2) { 00069 return arg_1 - arg_2; 00070 } 00071 00072 static complex<double> 00073 GLUE_13 (const complex<double> &arg_1, const complex<double> &arg_2) { 00074 return arg_1 * arg_2; 00075 } 00076 00077 static complex<double> 00078 GLUE_14 (const double &arg_1, const complex<double> &arg_2) { 00079 return arg_1 + arg_2; 00080 } 00081 00082 static complex<double> 00083 GLUE_15 (const complex<double> &arg_1, const double &arg_2) { 00084 return arg_1 + arg_2; 00085 } 00086 00087 static complex<double> 00088 GLUE_16 (const double &arg_1, const complex<double> &arg_2) { 00089 return arg_1 - arg_2; 00090 } 00091 00092 static complex<double> 00093 GLUE_17 (const complex<double> &arg_1, const double &arg_2) { 00094 return arg_1 - arg_2; 00095 } 00096 00097 static complex<double> 00098 GLUE_18 (const double &arg_1, const complex<double> &arg_2) { 00099 return arg_1 * arg_2; 00100 } 00101 00102 static complex<double> 00103 GLUE_19 (const complex<double> &arg_1, const double &arg_2) { 00104 return arg_1 * arg_2; 00105 } 00106 00107 static complex<double> 00108 GLUE_20 (const complex<double> &arg_1, const complex<double> &arg_2) { 00109 return arg_1 / arg_2; 00110 } 00111 00112 static complex<double> 00113 GLUE_21 (const double &arg_1, const complex<double> &arg_2) { 00114 return arg_1 / arg_2; 00115 } 00116 00117 static complex<double> 00118 GLUE_22 (const complex<double> &arg_1, const double &arg_2) { 00119 return arg_1 / arg_2; 00120 } 00121 00122 static double 00123 GLUE_23 (const complex<double> &arg_1) { 00124 return abs (arg_1); 00125 } 00126 00127 static double 00128 GLUE_24 (const complex<double> &arg_1) { 00129 return arg (arg_1); 00130 } 00131 00132 static complex<double> 00133 GLUE_25 (const complex<double> &arg_1) { 00134 return sqrt (arg_1); 00135 } 00136 00137 static complex<double> 00138 GLUE_26 (const complex<double> &arg_1) { 00139 return exp (arg_1); 00140 } 00141 00142 static complex<double> 00143 GLUE_27 (const complex<double> &arg_1) { 00144 return log (arg_1); 00145 } 00146 00147 static complex<double> 00148 GLUE_28 (const complex<double> &arg_1, const complex<double> &arg_2) { 00149 return pow (arg_1, arg_2); 00150 } 00151 00152 static complex<double> 00153 GLUE_29 (const complex<double> &arg_1) { 00154 return cos (arg_1); 00155 } 00156 00157 static complex<double> 00158 GLUE_30 (const complex<double> &arg_1) { 00159 return sin (arg_1); 00160 } 00161 00162 static complex<double> 00163 GLUE_31 (const complex<double> &arg_1) { 00164 return tan (arg_1); 00165 } 00166 00167 static complex<double> 00168 GLUE_32 (const complex<double> &arg_1) { 00169 return acos (arg_1); 00170 } 00171 00172 static complex<double> 00173 GLUE_33 (const complex<double> &arg_1) { 00174 return asin (arg_1); 00175 } 00176 00177 static complex<double> 00178 GLUE_34 (const complex<double> &arg_1) { 00179 return atan (arg_1); 00180 } 00181 00182 static bool 00183 GLUE_35 (const complex<double> &arg_1) { 00184 return is_finite (arg_1); 00185 } 00186 00187 static bool 00188 GLUE_36 (const complex<double> &arg_1) { 00189 return is_infinite (arg_1); 00190 } 00191 00192 static bool 00193 GLUE_37 (const complex<double> &arg_1) { 00194 return is_nan (arg_1); 00195 } 00196 00197 static complex<double> 00198 GLUE_38 (const complex<double> &arg_1) { 00199 return times_infinity (arg_1); 00200 } 00201 00202 static int 00203 GLUE_39 (const complex<double> &arg_1) { 00204 return precision (arg_1); 00205 } 00206 00207 static int 00208 GLUE_40 (const complex<double> &arg_1) { 00209 return exponent (arg_1); 00210 } 00211 00212 static double 00213 GLUE_41 (const complex<double> &arg_1) { 00214 return magnitude (arg_1); 00215 } 00216 00217 static complex<double> 00218 GLUE_42 (const complex<double> &arg_1, const int &arg_2) { 00219 return incexp2 (arg_1, arg_2); 00220 } 00221 00222 static complex<double> 00223 GLUE_43 (const complex<double> &arg_1, const int &arg_2) { 00224 return decexp2 (arg_1, arg_2); 00225 } 00226 00227 static double 00228 GLUE_44 (const complex<double> &arg_1) { 00229 return rounding_error (arg_1); 00230 } 00231 00232 static double 00233 GLUE_45 (const complex<double> &arg_1) { 00234 return additive_error (arg_1); 00235 } 00236 00237 static double 00238 GLUE_46 (const complex<double> &arg_1) { 00239 return multiplicative_error (arg_1); 00240 } 00241 00242 static double 00243 GLUE_47 (const complex<double> &arg_1) { 00244 return elementary_error (arg_1); 00245 } 00246 00247 static complex<generic> 00248 GLUE_48 (const complex<double> &arg_1) { 00249 return as<complex<generic> > (arg_1); 00250 } 00251 00252 static complex<double> 00253 GLUE_49 (const complex<rational> &arg_1) { 00254 return as<complex<double> > (arg_1); 00255 } 00256 00257 void 00258 glue_complex_double () { 00259 static bool done = false; 00260 if (done) return; 00261 done = true; 00262 call_glue (string ("glue_double")); 00263 call_glue (string ("glue_complex_rational")); 00264 define_type<complex<double> > (gen (lit ("Complex"), lit ("Double"))); 00265 define ("complex", GLUE_1); 00266 define ("complex", GLUE_2); 00267 define_converter ("upgrade", GLUE_3, PENALTY_HOMOMORPHISM); 00268 define ("Re", GLUE_4); 00269 define ("Im", GLUE_5); 00270 define ("conj", GLUE_6); 00271 define ("times_i", GLUE_7); 00272 define ("over_i", GLUE_8); 00273 define ("-", GLUE_9); 00274 define ("square", GLUE_10); 00275 define ("+", GLUE_11); 00276 define ("-", GLUE_12); 00277 define ("*", GLUE_13); 00278 define ("+", GLUE_14); 00279 define ("+", GLUE_15); 00280 define ("-", GLUE_16); 00281 define ("-", GLUE_17); 00282 define ("*", GLUE_18); 00283 define ("*", GLUE_19); 00284 define ("/", GLUE_20); 00285 define ("/", GLUE_21); 00286 define ("/", GLUE_22); 00287 define ("abs", GLUE_23); 00288 define ("arg", GLUE_24); 00289 define ("sqrt", GLUE_25); 00290 define ("exp", GLUE_26); 00291 define ("log", GLUE_27); 00292 define ("^", GLUE_28); 00293 define ("cos", GLUE_29); 00294 define ("sin", GLUE_30); 00295 define ("tan", GLUE_31); 00296 define ("arccos", GLUE_32); 00297 define ("arcsin", GLUE_33); 00298 define ("arctan", GLUE_34); 00299 define ("finite?", GLUE_35); 00300 define ("infinite?", GLUE_36); 00301 define ("nan?", GLUE_37); 00302 define ("times_infinity", GLUE_38); 00303 define ("precision", GLUE_39); 00304 define ("exponent", GLUE_40); 00305 define ("magnitude", GLUE_41); 00306 define ("increase_exponent", GLUE_42); 00307 define ("decrease_exponent", GLUE_43); 00308 define ("rounding_error", GLUE_44); 00309 define ("additive_error", GLUE_45); 00310 define ("multiplicative_error", GLUE_46); 00311 define ("elementary_error", GLUE_47); 00312 define_converter (":>", GLUE_48, PENALTY_PROMOTE_GENERIC); 00313 define_converter (":>", GLUE_49, PENALTY_INCLUSION); 00314 } 00315 }