00001 00002 #include <basix/double.hpp> 00003 #include <basix/int.hpp> 00004 #include <basix/vector.hpp> 00005 #include <basix/port.hpp> 00006 #include <basix/literal.hpp> 00007 #include <numerix/integer.hpp> 00008 #include <numerix/modular.hpp> 00009 #include <numerix/modular_integer.hpp> 00010 #include <numerix/rational.hpp> 00011 #include <numerix/complex.hpp> 00012 #include <numerix/complex_double.hpp> 00013 #include <numerix/tangent.hpp> 00014 #include <basix/glue.hpp> 00015 00016 #define double_literal(x) as_double (as_string (x)) 00017 #define int_literal(x) as_int (as_string (x)) 00018 #define is_generic_literal is<literal> 00019 #define gen_literal_apply(f,v) gen (as<generic> (f), v) 00020 #define gen_literal_access(f,v) access (as<generic> (f), v) 00021 00022 namespace mmx { 00023 static tangent<double, double> 00024 GLUE_1 (const double &arg_1) { 00025 return tangent<double, double > (arg_1); 00026 } 00027 00028 static tangent<double, double> 00029 GLUE_2 (const double &arg_1) { 00030 return tangent<double, double > (arg_1); 00031 } 00032 00033 static tangent<double, double> 00034 GLUE_3 (const double &arg_1, const double &arg_2) { 00035 return tangent<double, double > (arg_1, arg_2); 00036 } 00037 00038 static double 00039 GLUE_4 (const tangent<double, double> &arg_1) { 00040 return base (arg_1); 00041 } 00042 00043 static double 00044 GLUE_5 (const tangent<double, double> &arg_1) { 00045 return slope (arg_1); 00046 } 00047 00048 static tangent<double, double> 00049 GLUE_6 (const tangent<double, double> &arg_1) { 00050 return -arg_1; 00051 } 00052 00053 static tangent<double, double> 00054 GLUE_7 (const tangent<double, double> &arg_1) { 00055 return square (arg_1); 00056 } 00057 00058 static tangent<double, double> 00059 GLUE_8 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00060 return arg_1 + arg_2; 00061 } 00062 00063 static tangent<double, double> 00064 GLUE_9 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00065 return arg_1 - arg_2; 00066 } 00067 00068 static tangent<double, double> 00069 GLUE_10 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00070 return arg_1 * arg_2; 00071 } 00072 00073 static bool 00074 GLUE_11 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00075 return arg_1 == arg_2; 00076 } 00077 00078 static bool 00079 GLUE_12 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00080 return arg_1 != arg_2; 00081 } 00082 00083 static bool 00084 GLUE_13 (const tangent<double, double> &arg_1, const double &arg_2) { 00085 return arg_1 == arg_2; 00086 } 00087 00088 static bool 00089 GLUE_14 (const tangent<double, double> &arg_1, const double &arg_2) { 00090 return arg_1 != arg_2; 00091 } 00092 00093 static bool 00094 GLUE_15 (const double &arg_1, const tangent<double, double> &arg_2) { 00095 return arg_1 == arg_2; 00096 } 00097 00098 static bool 00099 GLUE_16 (const double &arg_1, const tangent<double, double> &arg_2) { 00100 return arg_1 != arg_2; 00101 } 00102 00103 static tangent<double, double> 00104 GLUE_17 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00105 return arg_1 / arg_2; 00106 } 00107 00108 static tangent<double, double> 00109 GLUE_18 (const tangent<double, double> &arg_1) { 00110 return sqrt (arg_1); 00111 } 00112 00113 static tangent<double, double> 00114 GLUE_19 (const tangent<double, double> &arg_1) { 00115 return exp (arg_1); 00116 } 00117 00118 static tangent<double, double> 00119 GLUE_20 (const tangent<double, double> &arg_1) { 00120 return log (arg_1); 00121 } 00122 00123 static tangent<double, double> 00124 GLUE_21 (const tangent<double, double> &arg_1, const tangent<double, double> &arg_2) { 00125 return pow (arg_1, arg_2); 00126 } 00127 00128 static tangent<double, double> 00129 GLUE_22 (const tangent<double, double> &arg_1) { 00130 return cos (arg_1); 00131 } 00132 00133 static tangent<double, double> 00134 GLUE_23 (const tangent<double, double> &arg_1) { 00135 return sin (arg_1); 00136 } 00137 00138 static tangent<double, double> 00139 GLUE_24 (const tangent<double, double> &arg_1) { 00140 return tan (arg_1); 00141 } 00142 00143 static tangent<double, double> 00144 GLUE_25 (const tangent<double, double> &arg_1) { 00145 return acos (arg_1); 00146 } 00147 00148 static tangent<double, double> 00149 GLUE_26 (const tangent<double, double> &arg_1) { 00150 return asin (arg_1); 00151 } 00152 00153 static tangent<double, double> 00154 GLUE_27 (const tangent<double, double> &arg_1) { 00155 return atan (arg_1); 00156 } 00157 00158 static bool 00159 GLUE_28 (const tangent<double, double> &arg_1) { 00160 return is_finite (arg_1); 00161 } 00162 00163 static bool 00164 GLUE_29 (const tangent<double, double> &arg_1) { 00165 return is_infinite (arg_1); 00166 } 00167 00168 static bool 00169 GLUE_30 (const tangent<double, double> &arg_1) { 00170 return is_nan (arg_1); 00171 } 00172 00173 static tangent<double, double> 00174 GLUE_31 (const tangent<double, double> &arg_1) { 00175 return times_infinity (arg_1); 00176 } 00177 00178 static int 00179 GLUE_32 (const tangent<double, double> &arg_1) { 00180 return precision (arg_1); 00181 } 00182 00183 static tangent<double, double> 00184 GLUE_33 (const tangent<double, double> &arg_1, const int &arg_2) { 00185 return change_precision (arg_1, arg_2); 00186 } 00187 00188 static int 00189 GLUE_34 (const tangent<double, double> &arg_1) { 00190 return exponent (arg_1); 00191 } 00192 00193 static double 00194 GLUE_35 (const tangent<double, double> &arg_1) { 00195 return magnitude (arg_1); 00196 } 00197 00198 static tangent<double, double> 00199 GLUE_36 (const tangent<double, double> &arg_1, const int &arg_2) { 00200 return incexp2 (arg_1, arg_2); 00201 } 00202 00203 static tangent<double, double> 00204 GLUE_37 (const tangent<double, double> &arg_1, const int &arg_2) { 00205 return decexp2 (arg_1, arg_2); 00206 } 00207 00208 static tangent<generic, generic> 00209 GLUE_38 (const tangent<double, double> &arg_1) { 00210 return as<tangent<generic, generic> > (arg_1); 00211 } 00212 00213 static tangent<complex<double> , complex<double> > 00214 GLUE_39 (const complex<double> &arg_1) { 00215 return tangent<complex<double>, complex<double> > (arg_1); 00216 } 00217 00218 static tangent<complex<double> , complex<double> > 00219 GLUE_40 (const complex<double> &arg_1) { 00220 return tangent<complex<double>, complex<double> > (arg_1); 00221 } 00222 00223 static tangent<complex<double> , complex<double> > 00224 GLUE_41 (const complex<double> &arg_1, const complex<double> &arg_2) { 00225 return tangent<complex<double>, complex<double> > (arg_1, arg_2); 00226 } 00227 00228 static complex<double> 00229 GLUE_42 (const tangent<complex<double> , complex<double> > &arg_1) { 00230 return base (arg_1); 00231 } 00232 00233 static complex<double> 00234 GLUE_43 (const tangent<complex<double> , complex<double> > &arg_1) { 00235 return slope (arg_1); 00236 } 00237 00238 static tangent<complex<double> , complex<double> > 00239 GLUE_44 (const tangent<complex<double> , complex<double> > &arg_1) { 00240 return -arg_1; 00241 } 00242 00243 static tangent<complex<double> , complex<double> > 00244 GLUE_45 (const tangent<complex<double> , complex<double> > &arg_1) { 00245 return square (arg_1); 00246 } 00247 00248 static tangent<complex<double> , complex<double> > 00249 GLUE_46 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00250 return arg_1 + arg_2; 00251 } 00252 00253 static tangent<complex<double> , complex<double> > 00254 GLUE_47 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00255 return arg_1 - arg_2; 00256 } 00257 00258 static tangent<complex<double> , complex<double> > 00259 GLUE_48 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00260 return arg_1 * arg_2; 00261 } 00262 00263 static bool 00264 GLUE_49 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00265 return arg_1 == arg_2; 00266 } 00267 00268 static bool 00269 GLUE_50 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00270 return arg_1 != arg_2; 00271 } 00272 00273 static bool 00274 GLUE_51 (const tangent<complex<double> , complex<double> > &arg_1, const complex<double> &arg_2) { 00275 return arg_1 == arg_2; 00276 } 00277 00278 static bool 00279 GLUE_52 (const tangent<complex<double> , complex<double> > &arg_1, const complex<double> &arg_2) { 00280 return arg_1 != arg_2; 00281 } 00282 00283 static bool 00284 GLUE_53 (const complex<double> &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00285 return arg_1 == arg_2; 00286 } 00287 00288 static bool 00289 GLUE_54 (const complex<double> &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00290 return arg_1 != arg_2; 00291 } 00292 00293 static tangent<complex<double> , complex<double> > 00294 GLUE_55 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00295 return arg_1 / arg_2; 00296 } 00297 00298 static tangent<complex<double> , complex<double> > 00299 GLUE_56 (const tangent<complex<double> , complex<double> > &arg_1) { 00300 return sqrt (arg_1); 00301 } 00302 00303 static tangent<complex<double> , complex<double> > 00304 GLUE_57 (const tangent<complex<double> , complex<double> > &arg_1) { 00305 return exp (arg_1); 00306 } 00307 00308 static tangent<complex<double> , complex<double> > 00309 GLUE_58 (const tangent<complex<double> , complex<double> > &arg_1) { 00310 return log (arg_1); 00311 } 00312 00313 static tangent<complex<double> , complex<double> > 00314 GLUE_59 (const tangent<complex<double> , complex<double> > &arg_1, const tangent<complex<double> , complex<double> > &arg_2) { 00315 return pow (arg_1, arg_2); 00316 } 00317 00318 static tangent<complex<double> , complex<double> > 00319 GLUE_60 (const tangent<complex<double> , complex<double> > &arg_1) { 00320 return cos (arg_1); 00321 } 00322 00323 static tangent<complex<double> , complex<double> > 00324 GLUE_61 (const tangent<complex<double> , complex<double> > &arg_1) { 00325 return sin (arg_1); 00326 } 00327 00328 static tangent<complex<double> , complex<double> > 00329 GLUE_62 (const tangent<complex<double> , complex<double> > &arg_1) { 00330 return tan (arg_1); 00331 } 00332 00333 static tangent<complex<double> , complex<double> > 00334 GLUE_63 (const tangent<complex<double> , complex<double> > &arg_1) { 00335 return acos (arg_1); 00336 } 00337 00338 static tangent<complex<double> , complex<double> > 00339 GLUE_64 (const tangent<complex<double> , complex<double> > &arg_1) { 00340 return asin (arg_1); 00341 } 00342 00343 static tangent<complex<double> , complex<double> > 00344 GLUE_65 (const tangent<complex<double> , complex<double> > &arg_1) { 00345 return atan (arg_1); 00346 } 00347 00348 static bool 00349 GLUE_66 (const tangent<complex<double> , complex<double> > &arg_1) { 00350 return is_finite (arg_1); 00351 } 00352 00353 static bool 00354 GLUE_67 (const tangent<complex<double> , complex<double> > &arg_1) { 00355 return is_infinite (arg_1); 00356 } 00357 00358 static bool 00359 GLUE_68 (const tangent<complex<double> , complex<double> > &arg_1) { 00360 return is_nan (arg_1); 00361 } 00362 00363 static tangent<complex<double> , complex<double> > 00364 GLUE_69 (const tangent<complex<double> , complex<double> > &arg_1) { 00365 return times_infinity (arg_1); 00366 } 00367 00368 static int 00369 GLUE_70 (const tangent<complex<double> , complex<double> > &arg_1) { 00370 return precision (arg_1); 00371 } 00372 00373 static tangent<complex<double> , complex<double> > 00374 GLUE_71 (const tangent<complex<double> , complex<double> > &arg_1, const int &arg_2) { 00375 return change_precision (arg_1, arg_2); 00376 } 00377 00378 static int 00379 GLUE_72 (const tangent<complex<double> , complex<double> > &arg_1) { 00380 return exponent (arg_1); 00381 } 00382 00383 static double 00384 GLUE_73 (const tangent<complex<double> , complex<double> > &arg_1) { 00385 return magnitude (arg_1); 00386 } 00387 00388 static tangent<complex<double> , complex<double> > 00389 GLUE_74 (const tangent<complex<double> , complex<double> > &arg_1, const int &arg_2) { 00390 return incexp2 (arg_1, arg_2); 00391 } 00392 00393 static tangent<complex<double> , complex<double> > 00394 GLUE_75 (const tangent<complex<double> , complex<double> > &arg_1, const int &arg_2) { 00395 return decexp2 (arg_1, arg_2); 00396 } 00397 00398 static tangent<complex<double> , complex<double> > 00399 GLUE_76 (const tangent<double, double> &arg_1) { 00400 return as<tangent<complex<double> , complex<double> > > (arg_1); 00401 } 00402 00403 static tangent<double, double> 00404 GLUE_77 (const tangent<rational, rational> &arg_1) { 00405 return as<tangent<double, double> > (arg_1); 00406 } 00407 00408 static tangent<complex<double> , complex<double> > 00409 GLUE_78 (const tangent<rational, rational> &arg_1) { 00410 return as<tangent<complex<double> , complex<double> > > (arg_1); 00411 } 00412 00413 static tangent<complex<double> , complex<double> > 00414 GLUE_79 (const tangent<complex<rational> , complex<rational> > &arg_1) { 00415 return as<tangent<complex<double> , complex<double> > > (arg_1); 00416 } 00417 00418 static tangent<generic, generic> 00419 GLUE_80 (const tangent<complex<double> , complex<double> > &arg_1) { 00420 return as<tangent<generic, generic> > (arg_1); 00421 } 00422 00423 void 00424 glue_tangent_double () { 00425 static bool done = false; 00426 if (done) return; 00427 done = true; 00428 call_glue (string ("glue_complex_double")); 00429 call_glue (string ("glue_tangent_rational")); 00430 define_type<tangent<double, double> > (gen (lit ("Tangent"), lit ("Double"), lit ("Double"))); 00431 define ("tangent", GLUE_1); 00432 define_converter ("upgrade", GLUE_2, PENALTY_HOMOMORPHISM); 00433 define ("tangent", GLUE_3); 00434 define ("base", GLUE_4); 00435 define ("slope", GLUE_5); 00436 define ("-", GLUE_6); 00437 define ("square", GLUE_7); 00438 define ("+", GLUE_8); 00439 define ("-", GLUE_9); 00440 define ("*", GLUE_10); 00441 define ("=", GLUE_11); 00442 define ("!=", GLUE_12); 00443 define ("=", GLUE_13); 00444 define ("!=", GLUE_14); 00445 define ("=", GLUE_15); 00446 define ("!=", GLUE_16); 00447 define ("/", GLUE_17); 00448 define ("sqrt", GLUE_18); 00449 define ("exp", GLUE_19); 00450 define ("log", GLUE_20); 00451 define ("^", GLUE_21); 00452 define ("cos", GLUE_22); 00453 define ("sin", GLUE_23); 00454 define ("tan", GLUE_24); 00455 define ("arccos", GLUE_25); 00456 define ("arcsin", GLUE_26); 00457 define ("arctan", GLUE_27); 00458 define ("finite?", GLUE_28); 00459 define ("infinite?", GLUE_29); 00460 define ("nan?", GLUE_30); 00461 define ("times_infinity", GLUE_31); 00462 define ("precision", GLUE_32); 00463 define ("change_precision", GLUE_33); 00464 define ("exponent", GLUE_34); 00465 define ("magnitude", GLUE_35); 00466 define ("increase_exponent", GLUE_36); 00467 define ("decrease_exponent", GLUE_37); 00468 define_converter (":>", GLUE_38, PENALTY_PROMOTE_GENERIC); 00469 define_type<tangent<complex<double> , complex<double> > > (gen (lit ("Tangent"), gen (lit ("Complex"), lit ("Double")), gen (lit ("Complex"), lit ("Double")))); 00470 define ("tangent", GLUE_39); 00471 define_converter ("upgrade", GLUE_40, PENALTY_HOMOMORPHISM); 00472 define ("tangent", GLUE_41); 00473 define ("base", GLUE_42); 00474 define ("slope", GLUE_43); 00475 define ("-", GLUE_44); 00476 define ("square", GLUE_45); 00477 define ("+", GLUE_46); 00478 define ("-", GLUE_47); 00479 define ("*", GLUE_48); 00480 define ("=", GLUE_49); 00481 define ("!=", GLUE_50); 00482 define ("=", GLUE_51); 00483 define ("!=", GLUE_52); 00484 define ("=", GLUE_53); 00485 define ("!=", GLUE_54); 00486 define ("/", GLUE_55); 00487 define ("sqrt", GLUE_56); 00488 define ("exp", GLUE_57); 00489 define ("log", GLUE_58); 00490 define ("^", GLUE_59); 00491 define ("cos", GLUE_60); 00492 define ("sin", GLUE_61); 00493 define ("tan", GLUE_62); 00494 define ("arccos", GLUE_63); 00495 define ("arcsin", GLUE_64); 00496 define ("arctan", GLUE_65); 00497 define ("finite?", GLUE_66); 00498 define ("infinite?", GLUE_67); 00499 define ("nan?", GLUE_68); 00500 define ("times_infinity", GLUE_69); 00501 define ("precision", GLUE_70); 00502 define ("change_precision", GLUE_71); 00503 define ("exponent", GLUE_72); 00504 define ("magnitude", GLUE_73); 00505 define ("increase_exponent", GLUE_74); 00506 define ("decrease_exponent", GLUE_75); 00507 define_converter (":>", GLUE_76, PENALTY_INCLUSION); 00508 define_converter (":>", GLUE_77, PENALTY_INCLUSION); 00509 define_converter (":>", GLUE_78, PENALTY_HOMOMORPHISM); 00510 define_converter (":>", GLUE_79, PENALTY_INCLUSION); 00511 define_converter (":>", GLUE_80, PENALTY_PROMOTE_GENERIC); 00512 } 00513 }