algebramix_doc 0.3
/Users/mourrain/Devel/mmx/algebramix/glue/glue_vector_modular_integer.cpp
Go to the documentation of this file.
00001 
00002 #include <basix/int.hpp>
00003 #include <numerix/integer.hpp>
00004 #include <numerix/modular.hpp>
00005 #include <numerix/modular_integer.hpp>
00006 #include <basix/vector.hpp>
00007 #include <basix/tuple.hpp>
00008 #include <basix/alias.hpp>
00009 #include <basix/glue.hpp>
00010 
00011 #define int_literal(x) as_int (as_string (x))
00012 
00013 namespace mmx {
00014   static mmx_modular(int)
00015   GLUE_1 (const mmx_modular(int) &arg_1, const integer &arg_2) {
00016     return binpow (arg_1, arg_2);
00017   }
00018   
00019   static modulus<integer>
00020   GLUE_2 (const integer &arg_1) {
00021     return modulus<integer > (arg_1);
00022   }
00023   
00024   static modulus<integer>
00025   GLUE_3 (const integer &arg_1) {
00026     return modulus<integer > (arg_1);
00027   }
00028   
00029   static integer
00030   GLUE_4 (const modulus<integer> &arg_1) {
00031     return *arg_1;
00032   }
00033   
00034   static mmx_modular(integer)
00035   GLUE_5 (const integer &arg_1, const integer &arg_2) {
00036     return (mmx_modular(integer ) (arg_1, arg_2));
00037   }
00038   
00039   static mmx_modular(integer)
00040   GLUE_6 (const integer &arg_1, const modulus<integer> &arg_2) {
00041     return (mmx_modular(integer ) (arg_1, arg_2));
00042   }
00043   
00044   static mmx_modular(integer)
00045   GLUE_7 (const integer &arg_1, const modulus<integer> &arg_2) {
00046     return (mmx_modular(integer ) (arg_1, arg_2));
00047   }
00048   
00049   static modulus<integer>
00050   GLUE_8 (const mmx_modular(integer) &arg_1) {
00051     return get_modulus (arg_1);
00052   }
00053   
00054   static integer
00055   GLUE_9 (const mmx_modular(integer) &arg_1) {
00056     return *arg_1;
00057   }
00058   
00059   static mmx_modular(integer)
00060   GLUE_10 (const mmx_modular(integer) &arg_1) {
00061     return -arg_1;
00062   }
00063   
00064   static mmx_modular(integer)
00065   GLUE_11 (const mmx_modular(integer) &arg_1) {
00066     return square (arg_1);
00067   }
00068   
00069   static mmx_modular(integer)
00070   GLUE_12 (const mmx_modular(integer) &arg_1, const mmx_modular(integer) &arg_2) {
00071     return arg_1 + arg_2;
00072   }
00073   
00074   static mmx_modular(integer)
00075   GLUE_13 (const mmx_modular(integer) &arg_1, const mmx_modular(integer) &arg_2) {
00076     return arg_1 - arg_2;
00077   }
00078   
00079   static mmx_modular(integer)
00080   GLUE_14 (const mmx_modular(integer) &arg_1, const mmx_modular(integer) &arg_2) {
00081     return arg_1 * arg_2;
00082   }
00083   
00084   static mmx_modular(integer)
00085   GLUE_15 (const integer &arg_1, const mmx_modular(integer) &arg_2) {
00086     return arg_1 + arg_2;
00087   }
00088   
00089   static mmx_modular(integer)
00090   GLUE_16 (const mmx_modular(integer) &arg_1, const integer &arg_2) {
00091     return arg_1 + arg_2;
00092   }
00093   
00094   static mmx_modular(integer)
00095   GLUE_17 (const integer &arg_1, const mmx_modular(integer) &arg_2) {
00096     return arg_1 - arg_2;
00097   }
00098   
00099   static mmx_modular(integer)
00100   GLUE_18 (const mmx_modular(integer) &arg_1, const integer &arg_2) {
00101     return arg_1 - arg_2;
00102   }
00103   
00104   static mmx_modular(integer)
00105   GLUE_19 (const integer &arg_1, const mmx_modular(integer) &arg_2) {
00106     return arg_1 * arg_2;
00107   }
00108   
00109   static mmx_modular(integer)
00110   GLUE_20 (const mmx_modular(integer) &arg_1, const integer &arg_2) {
00111     return arg_1 * arg_2;
00112   }
00113   
00114   static mmx_modular(integer)
00115   GLUE_21 (const mmx_modular(integer) &arg_1, const mmx_modular(integer) &arg_2) {
00116     return arg_1 / arg_2;
00117   }
00118   
00119   static mmx_modular(integer)
00120   GLUE_22 (const integer &arg_1, const mmx_modular(integer) &arg_2) {
00121     return arg_1 / arg_2;
00122   }
00123   
00124   static mmx_modular(integer)
00125   GLUE_23 (const mmx_modular(integer) &arg_1, const integer &arg_2) {
00126     return arg_1 / arg_2;
00127   }
00128   
00129   static mmx_modular(integer)
00130   GLUE_24 (const mmx_modular(integer) &arg_1, const int &arg_2) {
00131     return binpow (arg_1, arg_2);
00132   }
00133   
00134   static mmx_modular(integer)
00135   GLUE_25 (const mmx_modular(integer) &arg_1, const integer &arg_2) {
00136     return binpow (arg_1, arg_2);
00137   }
00138   
00139   static vector<mmx_modular(integer) >
00140   GLUE_26 (const tuple<mmx_modular(integer) > &arg_1) {
00141     return vector<mmx_modular(integer) > (as_vector (arg_1));
00142   }
00143   
00144   static vector<mmx_modular(integer) >
00145   GLUE_27 (const tuple<mmx_modular(integer) > &arg_1) {
00146     return vector<mmx_modular(integer) > (as_vector (arg_1));
00147   }
00148   
00149   static iterator<generic>
00150   GLUE_28 (const vector<mmx_modular(integer) > &arg_1) {
00151     return as<iterator<generic> > (iterate (arg_1));
00152   }
00153   
00154   static int
00155   GLUE_29 (const vector<mmx_modular(integer) > &arg_1) {
00156     return N (arg_1);
00157   }
00158   
00159   static mmx_modular(integer)
00160   GLUE_30 (const vector<mmx_modular(integer) > &arg_1, const int &arg_2) {
00161     return arg_1[arg_2];
00162   }
00163   
00164   static alias<mmx_modular(integer) >
00165   GLUE_31 (const alias<vector<mmx_modular(integer) > > &arg_1, const int &arg_2) {
00166     return alias_access<mmx_modular(integer) > (arg_1, arg_2);
00167   }
00168   
00169   static vector<mmx_modular(integer) >
00170   GLUE_32 (const vector<mmx_modular(integer) > &arg_1, const int &arg_2, const int &arg_3) {
00171     return range (arg_1, arg_2, arg_3);
00172   }
00173   
00174   static vector<mmx_modular(integer) >
00175   GLUE_33 (const vector<mmx_modular(integer) > &arg_1) {
00176     return reverse (arg_1);
00177   }
00178   
00179   static vector<mmx_modular(integer) >
00180   GLUE_34 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00181     return append (arg_1, arg_2);
00182   }
00183   
00184   static alias<vector<mmx_modular(integer) > >
00185   GLUE_35 (const alias<vector<mmx_modular(integer) > > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00186     return alias_write (arg_1, arg_2);
00187   }
00188   
00189   static vector<mmx_modular(integer) >
00190   GLUE_36 (const mmx_modular(integer) &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00191     return cons (arg_1, arg_2);
00192   }
00193   
00194   static mmx_modular(integer)
00195   GLUE_37 (const vector<mmx_modular(integer) > &arg_1) {
00196     return car (arg_1);
00197   }
00198   
00199   static vector<mmx_modular(integer) >
00200   GLUE_38 (const vector<mmx_modular(integer) > &arg_1) {
00201     return cdr (arg_1);
00202   }
00203   
00204   static bool
00205   GLUE_39 (const vector<mmx_modular(integer) > &arg_1) {
00206     return is_nil (arg_1);
00207   }
00208   
00209   static bool
00210   GLUE_40 (const vector<mmx_modular(integer) > &arg_1) {
00211     return is_atom (arg_1);
00212   }
00213   
00214   static vector<mmx_modular(integer) >
00215   GLUE_41 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00216     return insert (arg_1, arg_2);
00217   }
00218   
00219   static int
00220   GLUE_42 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00221     return find (arg_1, arg_2);
00222   }
00223   
00224   static bool
00225   GLUE_43 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00226     return contains (arg_1, arg_2);
00227   }
00228   
00229   static vector<generic>
00230   GLUE_44 (const vector<mmx_modular(integer) > &arg_1) {
00231     return as<vector<generic> > (arg_1);
00232   }
00233   
00234   static vector<mmx_modular(integer) >
00235   GLUE_45 (const vector<mmx_modular(integer) > &arg_1) {
00236     return -arg_1;
00237   }
00238   
00239   static vector<mmx_modular(integer) >
00240   GLUE_46 (const vector<mmx_modular(integer) > &arg_1) {
00241     return square (arg_1);
00242   }
00243   
00244   static vector<mmx_modular(integer) >
00245   GLUE_47 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00246     return arg_1 + arg_2;
00247   }
00248   
00249   static vector<mmx_modular(integer) >
00250   GLUE_48 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00251     return arg_1 - arg_2;
00252   }
00253   
00254   static vector<mmx_modular(integer) >
00255   GLUE_49 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00256     return arg_1 * arg_2;
00257   }
00258   
00259   static vector<mmx_modular(integer) >
00260   GLUE_50 (const mmx_modular(integer) &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00261     return arg_1 + arg_2;
00262   }
00263   
00264   static vector<mmx_modular(integer) >
00265   GLUE_51 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00266     return arg_1 + arg_2;
00267   }
00268   
00269   static vector<mmx_modular(integer) >
00270   GLUE_52 (const mmx_modular(integer) &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00271     return arg_1 - arg_2;
00272   }
00273   
00274   static vector<mmx_modular(integer) >
00275   GLUE_53 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00276     return arg_1 - arg_2;
00277   }
00278   
00279   static vector<mmx_modular(integer) >
00280   GLUE_54 (const mmx_modular(integer) &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00281     return arg_1 * arg_2;
00282   }
00283   
00284   static vector<mmx_modular(integer) >
00285   GLUE_55 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00286     return arg_1 * arg_2;
00287   }
00288   
00289   static mmx_modular(integer)
00290   GLUE_56 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00291     return dot (arg_1, arg_2);
00292   }
00293   
00294   static mmx_modular(integer)
00295   GLUE_57 (const vector<mmx_modular(integer) > &arg_1) {
00296     return big_mul (arg_1);
00297   }
00298   
00299   static mmx_modular(integer)
00300   GLUE_58 (const vector<mmx_modular(integer) > &arg_1) {
00301     return big_add (arg_1);
00302   }
00303   
00304   static vector<mmx_modular(integer) >
00305   GLUE_59 (const vector<mmx_modular(integer) > &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00306     return arg_1 / arg_2;
00307   }
00308   
00309   static vector<mmx_modular(integer) >
00310   GLUE_60 (const mmx_modular(integer) &arg_1, const vector<mmx_modular(integer) > &arg_2) {
00311     return arg_1 / arg_2;
00312   }
00313   
00314   static vector<mmx_modular(integer) >
00315   GLUE_61 (const vector<mmx_modular(integer) > &arg_1, const mmx_modular(integer) &arg_2) {
00316     return arg_1 / arg_2;
00317   }
00318   
00319   void
00320   glue_vector_modular_integer () {
00321     static bool done = false;
00322     if (done) return;
00323     done = true;
00324     call_glue (string ("glue_modular_integer"));
00325     call_glue (string ("glue_vector_integer"));
00326     define_type<modulus<integer> > (gen (lit ("Modulus"), lit ("Integer")));
00327     define_type<mmx_modular(integer) > (gen (lit ("Modular"), lit ("Integer")));
00328     define ("^", GLUE_1);
00329     define ("modulus", GLUE_2);
00330     define_converter ("upgrade", GLUE_3, PENALTY_HOMOMORPHISM);
00331     define_converter (":>", GLUE_4, PENALTY_CAST);
00332     define ("modular", GLUE_5);
00333     define ("modular", GLUE_6);
00334     define ("mod", GLUE_7);
00335     define ("get_modulus", GLUE_8);
00336     define ("preimage", GLUE_9);
00337     define ("-", GLUE_10);
00338     define ("square", GLUE_11);
00339     define ("+", GLUE_12);
00340     define ("-", GLUE_13);
00341     define ("*", GLUE_14);
00342     define ("+", GLUE_15);
00343     define ("+", GLUE_16);
00344     define ("-", GLUE_17);
00345     define ("-", GLUE_18);
00346     define ("*", GLUE_19);
00347     define ("*", GLUE_20);
00348     define ("/", GLUE_21);
00349     define ("/", GLUE_22);
00350     define ("/", GLUE_23);
00351     define ("^", GLUE_24);
00352     define ("^", GLUE_25);
00353     define_type<vector<mmx_modular(integer) > > (gen (lit ("Vector"), gen (lit ("Modular"), lit ("Integer"))));
00354     define ("vector", GLUE_26);
00355     define ("[]", GLUE_27);
00356     define_converter (":>", GLUE_28, PENALTY_CAST);
00357     define ("#", GLUE_29);
00358     define (".[]", GLUE_30);
00359     define (".[]", GLUE_31);
00360     define (".[]", GLUE_32);
00361     define ("reverse", GLUE_33);
00362     define ("><", GLUE_34);
00363     define ("<<", GLUE_35);
00364     define ("cons", GLUE_36);
00365     define ("car", GLUE_37);
00366     define ("cdr", GLUE_38);
00367     define ("nil?", GLUE_39);
00368     define ("atom?", GLUE_40);
00369     define ("insert", GLUE_41);
00370     define ("find", GLUE_42);
00371     define ("contains?", GLUE_43);
00372     define_converter (":>", GLUE_44, PENALTY_PROMOTE_GENERIC);
00373     define ("-", GLUE_45);
00374     define ("square", GLUE_46);
00375     define ("+", GLUE_47);
00376     define ("-", GLUE_48);
00377     define ("*", GLUE_49);
00378     define ("+", GLUE_50);
00379     define ("+", GLUE_51);
00380     define ("-", GLUE_52);
00381     define ("-", GLUE_53);
00382     define ("*", GLUE_54);
00383     define ("*", GLUE_55);
00384     define ("dot", GLUE_56);
00385     define ("big_mul", GLUE_57);
00386     define ("big_add", GLUE_58);
00387     define ("/", GLUE_59);
00388     define ("/", GLUE_60);
00389     define ("/", GLUE_61);
00390   }
00391 }
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines