algebramix_doc 0.3
/Users/mourrain/Devel/mmx/algebramix/glue/glue_p_expansion_modular_integer.cpp
Go to the documentation of this file.
00001 
00002 #include <basix/vector.hpp>
00003 #include <basix/int.hpp>
00004 #include <numerix/integer.hpp>
00005 #include <numerix/modular.hpp>
00006 #include <numerix/modular_integer.hpp>
00007 #include <algebramix/vector_unrolled.hpp>
00008 #include <algebramix/vector_simd.hpp>
00009 #include <algebramix/vector_modular.hpp>
00010 #include <algebramix/p_expansion.hpp>
00011 #include <algebramix/p_expansion_modular_integer.hpp>
00012 #include <basix/tuple.hpp>
00013 #include <basix/glue.hpp>
00014 
00015 #define int_literal(x) as_int (as_string (x))
00016 
00017 #define simple_p_expansion(C) polynomial<C, polynomial_carry_variant_helper<C>::PV>
00018 #define simple_as_p_expansion(C) as_p_expansion<C,Modulus_variant(C),modular_local>
00019 
00020 
00021 namespace mmx {
00022   static inline simple_p_expansion(mmx_modular(integer))
00023   integer_as_p_expansion(const integer& c, const modulus<integer>& p) {
00024     return simple_as_p_expansion(integer)(c, p); }
00025 }
00026 
00027 
00028 namespace mmx {
00029   static simple_p_expansion(mmx_modular(integer) )
00030   GLUE_1 (const tuple<mmx_modular(integer) > &arg_1) {
00031     return (simple_p_expansion(mmx_modular(integer) ) (as_vector (arg_1)));
00032   }
00033   
00034   static void
00035   GLUE_2 (const simple_p_expansion(mmx_modular(integer) ) &arg_1, const generic &arg_2) {
00036     set_variable_name (arg_1, arg_2);
00037   }
00038   
00039   static iterator<generic>
00040   GLUE_3 (const simple_p_expansion(mmx_modular(integer) ) &arg_1) {
00041     return as<iterator<generic> > (iterate (arg_1));
00042   }
00043   
00044   static int
00045   GLUE_4 (const simple_p_expansion(mmx_modular(integer) ) &arg_1) {
00046     return N (arg_1);
00047   }
00048   
00049   static int
00050   GLUE_5 (const simple_p_expansion(mmx_modular(integer) ) &arg_1) {
00051     return deg (arg_1);
00052   }
00053   
00054   static mmx_modular(integer)
00055   GLUE_6 (const simple_p_expansion(mmx_modular(integer) ) &arg_1, const int &arg_2) {
00056     return arg_1[arg_2];
00057   }
00058   
00059   static integer
00060   GLUE_7 (const simple_p_expansion(mmx_modular(integer) ) &arg_1) {
00061     return as<integer > (arg_1);
00062   }
00063   
00064   static simple_p_expansion(mmx_modular(integer) )
00065   GLUE_8 (const integer &arg_1, const modulus<integer> &arg_2) {
00066     return integer_as_p_expansion (arg_1, arg_2);
00067   }
00068   
00069   void
00070   glue_p_expansion_modular_integer () {
00071     static bool done = false;
00072     if (done) return;
00073     done = true;
00074     call_glue (string ("glue_vector_generic"));
00075     call_glue (string ("glue_modular_integer"));
00076     call_glue (string ("glue_vector_modular_integer"));
00077     define_type<simple_p_expansion(mmx_modular(integer) ) > (gen (lit ("P_expansion"), gen (lit ("Modular"), lit ("Integer"))));
00078     define ("p_expansion", GLUE_1);
00079     define ("set_variable_name", GLUE_2);
00080     define_converter (":>", GLUE_3, PENALTY_CAST);
00081     define ("#", GLUE_4);
00082     define ("deg", GLUE_5);
00083     define (".[]", GLUE_6);
00084     define ("integer", GLUE_7);
00085     define ("p_expansion", GLUE_8);
00086   }
00087 }
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines