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 <algebramix/vector_unrolled.hpp>
00014 #include <algebramix/vector_simd.hpp>
00015 #include <algebramix/vector_modular.hpp>
00016 #include <analyziz/vector_double.hpp>
00017 #include <basix/compound.hpp>
00018 #include <basix/mmx_syntax.hpp>
00019 #include <basix/lisp_syntax.hpp>
00020 #include <basix/cpp_syntax.hpp>
00021 #include <basix/syntactic.hpp>
00022 #include <algebramix/polynomial.hpp>
00023 #include <algebramix/polynomial_polynomial.hpp>
00024 #include <algebramix/polynomial_integer.hpp>
00025 #include <algebramix/polynomial_rational.hpp>
00026 #include <algebramix/polynomial_modular.hpp>
00027 #include <algebramix/polynomial_modular_integer.hpp>
00028 #include <algebramix/polynomial_complex.hpp>
00029 #include <algebramix/polynomial_schonhage.hpp>
00030 #include <analyziz/polynomial_numeric.hpp>
00031 #include <analyziz/polynomial_double.hpp>
00032 #include <analyziz/solver.hpp>
00033 #include <analyziz/solver_aberth.hpp>
00034 #include <continewz/riemann_germ.hpp>
00035 #include <continewz/riemann_bundle.hpp>
00036 #include <basix/alias.hpp>
00037 #include <basix/glue.hpp>
00038
00039 #define double_literal(x) as_double (as_string (x))
00040 #define int_literal(x) as_int (as_string (x))
00041 #define is_generic_literal is<literal>
00042 #define gen_literal_apply(f,v) gen (as<generic> (f), v)
00043 #define gen_literal_access(f,v) access (as<generic> (f), v)
00044 #define is_generic_compound is<compound>
00045 #define compound_arguments(x) cdr (as_vector (x))
00046 #define gen_compound_apply(f,v) gen (as<generic> (f), v)
00047 namespace mmx {
00048 template<typename C> polynomial<C>
00049 polynomial_reverse (const vector<C>& v) {
00050 return polynomial<C> (reverse (v)); }
00051
00052 template<typename C> polynomial<modular<modulus<C>, modular_local> >
00053 as_polynomial_modular (const polynomial<C>& f, const modulus<C>& p) {
00054 modular<modulus<C>, modular_local>::set_modulus (p);
00055 return as<polynomial<modular<modulus<C>, modular_local> > > (f); }
00056
00057 template<typename C> vector<generic>
00058 wrap_subresultants (const polynomial<C>& f, const polynomial<C>& g) {
00059 return as<vector<generic> > (subresultants (f, g)); }
00060
00061 }
00062 namespace mmx { POLYNOMIAL_GENERIC_USES_SCHONHAGE }
00063 #define simple_riemann_bundle(R) riemann_bundle<riemann_germ<R >,R,std_riemann>
00064
00065 namespace mmx {
00066 template<typename R> riemann_surface<R>
00067 std_riemann_disk (const complex<R>& c, const R& r) {
00068 return riemann_disk<R,std_riemann> (c, r);
00069 }
00070 }
00071
00072
00073 namespace mmx {
00074 static riemann_square<double>
00075 GLUE_1 (const complex<double> &arg_1, const double &arg_2) {
00076 return riemann_square<double > (arg_1, arg_2);
00077 }
00078
00079 static bool
00080 GLUE_2 (const riemann_square<double> &arg_1) {
00081 return admissible (arg_1);
00082 }
00083
00084 static bool
00085 GLUE_3 (const riemann_square<double> &arg_1, const riemann_square<double> &arg_2) {
00086 return intersect (arg_1, arg_2);
00087 }
00088
00089 static bool
00090 GLUE_4 (const riemann_square<double> &arg_1, const riemann_square<double> &arg_2) {
00091 return included (arg_1, arg_2);
00092 }
00093
00094 static bool
00095 GLUE_5 (const riemann_square<double> &arg_1, const riemann_square<double> &arg_2) {
00096 return adjacent (arg_1, arg_2);
00097 }
00098
00099 static bool
00100 GLUE_6 (const complex<double> &arg_1, const riemann_square<double> &arg_2) {
00101 return inside (arg_1, arg_2);
00102 }
00103
00104 static riemann_point<double>
00105 GLUE_7 (const riemann_square<double> &arg_1, const complex<double> &arg_2) {
00106 return riemann_point<double > (arg_1, arg_2);
00107 }
00108
00109 static riemann_square<double>
00110 GLUE_8 (const riemann_point<double> &arg_1) {
00111 return owner (arg_1);
00112 }
00113
00114 static complex<double>
00115 GLUE_9 (const riemann_point<double> &arg_1) {
00116 return project (arg_1);
00117 }
00118
00119 static riemann_surface<double>
00120 GLUE_10 (const complex<double> &arg_1, const double &arg_2) {
00121 return std_riemann_disk (arg_1, arg_2);
00122 }
00123
00124 static void
00125 GLUE_11 (const alias<riemann_surface<double> > &arg_1, const riemann_point<double> &arg_2, const riemann_surface<double> &arg_3) {
00126 alias_glue (arg_1, arg_2, arg_3);
00127 }
00128
00129 static bool
00130 GLUE_12 (const riemann_surface<double> &arg_1) {
00131 return is_plane (arg_1);
00132 }
00133
00134 static riemann_point<double>
00135 GLUE_13 (const riemann_surface<double> &arg_1, const complex<double> &arg_2) {
00136 return lift (arg_1, arg_2);
00137 }
00138
00139 static riemann_point<double>
00140 GLUE_14 (const riemann_surface<double> &arg_1, const riemann_point<double> &arg_2, const complex<double> &arg_3) {
00141 return move (arg_1, arg_2, arg_3);
00142 }
00143
00144 static complex<double>
00145 GLUE_15 (const riemann_germ<double> &arg_1) {
00146 return center (arg_1);
00147 }
00148
00149 static complex<double>
00150 GLUE_16 (const riemann_germ<double> &arg_1) {
00151 return radius (arg_1);
00152 }
00153
00154 static complex<double>
00155 GLUE_17 (const riemann_germ<double> &arg_1, const complex<double> &arg_2) {
00156 return eval (arg_1, arg_2);
00157 }
00158
00159 static simple_riemann_bundle(double)
00160 GLUE_18 (const riemann_surface<double> &arg_1, const riemann_germ<double> &arg_2) {
00161 return (simple_riemann_bundle(double ) (arg_1, arg_2));
00162 }
00163
00164 static void
00165 GLUE_19 (const alias<simple_riemann_bundle(double) > &arg_1, const riemann_point<double> &arg_2, const simple_riemann_bundle(double) &arg_3) {
00166 alias_glue (arg_1, arg_2, arg_3);
00167 }
00168
00169 static riemann_surface<double>
00170 GLUE_20 (const simple_riemann_bundle(double) &arg_1) {
00171 return bundle_surface (arg_1);
00172 }
00173
00174 static riemann_germ<double>
00175 GLUE_21 (const polynomial<complex<double> > &arg_1, const complex<double> &arg_2, const double &arg_3) {
00176 return riemann_germ<double > (arg_1, arg_2, arg_3);
00177 }
00178
00179 void
00180 glue_riemann_double () {
00181 static bool done = false;
00182 if (done) return;
00183 done = true;
00184 call_glue (string ("glue_polynomial_double"));
00185 define_type<riemann_square<double> > (gen (lit ("Riemann_square"), lit ("Double")));
00186 define_type<riemann_point<double> > (gen (lit ("Riemann_point"), lit ("Double")));
00187 define_type<riemann_surface<double> > (gen (lit ("Riemann_surface"), lit ("Double")));
00188 define_type<riemann_germ<double> > (gen (lit ("Riemann_germ"), lit ("Double")));
00189 define_type<simple_riemann_bundle(double) > (gen (lit ("Riemann_bundle"), lit ("Double")));
00190 define ("riemann_square", GLUE_1);
00191 define ("admissible?", GLUE_2);
00192 define ("intersect?", GLUE_3);
00193 define ("included?", GLUE_4);
00194 define ("adjacent?", GLUE_5);
00195 define ("inside?", GLUE_6);
00196 define ("riemann_point", GLUE_7);
00197 define ("owner", GLUE_8);
00198 define ("owner", GLUE_9);
00199 define ("riemann_disk", GLUE_10);
00200 define ("glue", GLUE_11);
00201 define ("plane?", GLUE_12);
00202 define ("lift", GLUE_13);
00203 define ("move", GLUE_14);
00204 define ("center", GLUE_15);
00205 define ("radius", GLUE_16);
00206 define ("eval", GLUE_17);
00207 define ("riemann_bundle", GLUE_18);
00208 define ("glue", GLUE_19);
00209 define ("surface", GLUE_20);
00210 define ("riemann_germ", GLUE_21);
00211 }
00212 }