00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __MMX__POLYNOMIAL_CARRY_NAIVE__HPP
00014 #define __MMX__POLYNOMIAL_CARRY_NAIVE__HPP
00015 #include <algebramix/polynomial_naive.hpp>
00016
00017 namespace mmx {
00018 #define TMPL template <typename C>
00019 #define TMPLK template <typename C, typename K>
00020 #define TMPLX template <typename C, typename X>
00021 #define TMPLP template <typename Polynomial>
00022 #define Vector vector<C>
00023 template <typename C, typename V> struct polynomial;
00024
00025
00026
00027
00028
00029 template<typename V>
00030 struct polynomial_carry_naive: public V {
00031 typedef typename V::Vec Vec;
00032 typedef typename V::Naive Naive;
00033 typedef polynomial_carry_naive<typename V::Positive> Positive;
00034 typedef polynomial_carry_naive<typename V::No_simd> No_simd;
00035 typedef polynomial_carry_naive<typename V::No_thread> No_thread;
00036 typedef polynomial_carry_naive<typename V::No_scaled> No_scaled;
00037 };
00038
00039 template<typename F, typename V, typename W>
00040 struct implementation<F,V,polynomial_carry_naive<W> >:
00041 public implementation<F,V,W> {};
00042
00043 template<typename C>
00044 struct polynomial_carry_variant_helper {
00045 typedef polynomial_carry_naive<polynomial_naive> PV;
00046 };
00047
00048 #define Polynomial_carry_variant(C) polynomial_carry_variant_helper<C>::PV
00049
00050
00051
00052
00053
00054 template<typename V,typename W>
00055 struct implementation<polynomial_defaults,V,polynomial_carry_naive<W> > {
00056 template<typename P>
00057 class global_variables {
00058 static inline generic& dyn_name () {
00059 static generic name = "p";
00060 return name; }
00061 public:
00062 static inline void set_variable_name (const generic& x) {
00063 dyn_name () = x; }
00064 static inline generic get_variable_name () {
00065 return dyn_name (); }
00066 };
00067
00068 };
00069
00070
00071
00072
00073
00074 template<typename V,typename W>
00075 struct implementation<polynomial_vectorial,V,polynomial_carry_naive<W> >:
00076 public implementation<polynomial_defaults,V>
00077 {
00078 typedef implementation<vector_linear,V> Vec;
00079
00080 TMPLX static inline void set (C* dest, const X& c, nat n) {
00081 Vec::set (dest, c, n); }
00082 TMPL static inline void clear (C* dest, nat n) {
00083 Vec::clear (dest, n); }
00084 TMPL static inline void copy (C* dest, const C* s, nat n) {
00085 Vec::copy (dest, s, n); }
00086 TMPLX static inline void cast (C* dest, const X* s, nat n) {
00087 Vec::cast (dest, s, n); }
00088 TMPL static inline void reverse (C* dest, const C* s, nat n) {
00089 Vec::vec_reverse (dest, s, n); }
00090
00091 TMPL static inline void add (C* dest, const C* s1, const C* s2, nat n) {
00092 ERROR ("not implemented"); }
00093 TMPL static inline void add (C* dest, const C* s, nat n) {
00094 ERROR ("not implemented"); }
00095 TMPL static inline void sub (C* dest, const C* s1, const C* s2, nat n) {
00096 ERROR ("not implemented"); }
00097 TMPL static inline void sub (C* dest, const C* s, nat n) {
00098 ERROR ("not implemented"); }
00099 TMPL static inline void mul_add (C* dest, const C* s1, const C* s2, nat n) {
00100 ERROR ("not implemented"); }
00101
00102 TMPLX static inline void mul_add (C* dest, const C* s, const X& c, nat n) {
00103 ERROR ("not implemented"); }
00104 TMPLX static inline void mul_add (C* dest, const X& c, const C* s, nat n) {
00105 ERROR ("not implemented"); }
00106 TMPL static inline void mul_sc (C* dest, const C* s, const C& c, nat n) {
00107 ERROR ("not implemented"); }
00108 TMPL static inline void mul_sc (C* dest, const C& c, nat n) {
00109 ERROR ("not implemented"); }
00110 TMPL static inline void div_sc (C* dest, const C* s, const C& c, nat n) {
00111 ERROR ("not implemented"); }
00112 TMPL static inline void div_sc (C* dest, const C& c, nat n) {
00113 ERROR ("not implemented"); }
00114 TMPL static inline void quo_sc (C* dest, const C* s, const C& c, nat n) {
00115 ERROR ("not implemented"); }
00116 TMPL static inline void quo_sc (C* dest, const C& c, nat n) {
00117 ERROR ("not implemented"); }
00118 TMPL static inline void rem_sc (C* dest, const C* s, const C& c, nat n) {
00119 ERROR ("not implemented"); }
00120 TMPL static inline void rem_sc (C* dest, const C& c, nat n) {
00121 ERROR ("not implemented"); }
00122 TMPL static inline bool equal (const C* s1, const C* s2, nat n) {
00123 ERROR ("not implemented"); }
00124 TMPL static inline bool equal (const C* s, const C& c, nat n) {
00125 ERROR ("not implemented"); }
00126 TMPL static inline bool exact_eq (const C* s1, const C* s2, nat n) {
00127 ERROR ("not implemented"); }
00128 TMPL static inline bool exact_eq (const C* s, const C& c, nat n) {
00129 ERROR ("not implemented"); }
00130 TMPL static inline void trim (const C* s, nat& n) {
00131 ERROR ("not implemented"); }
00132
00133 };
00134
00135
00136
00137
00138
00139 template<typename V,typename W>
00140 struct implementation<polynomial_multiply,V,polynomial_carry_naive<W> >:
00141 public implementation<polynomial_linear,V>
00142 {
00143 typedef implementation<polynomial_linear,V> Pol;
00144 typedef implementation<vector_linear,V> Vec;
00145
00146 TMPLK static void
00147 mul (C* dest, const C* s1, const K* s2, nat n1, nat n2) {
00148 ERROR ("not implemented"); }
00149
00150 TMPL static void
00151 square (C* dest, const C* s, nat n) {
00152 ERROR ("not implemented"); }
00153
00154 TMPL static void
00155 tmul (C* dest, const C* s1, const C* s2, nat n1, nat n2) {
00156 ERROR ("not implemented"); }
00157
00158 };
00159
00160
00161
00162
00163
00164 template<typename V, typename W>
00165 struct implementation<polynomial_divide,V,polynomial_carry_naive<W> >:
00166 public implementation<polynomial_multiply,V>
00167 {
00168 typedef implementation<polynomial_multiply,V> Pol;
00169 typedef implementation<vector_linear,V> Vec;
00170
00171 TMPL static void
00172 quo_rem (C* dest, C* s1, const C* s2, nat n1, nat n2) {
00173 ERROR ("not implemented"); }
00174
00175 TMPL static void
00176 tquo_rem (C* dest, const C* s1, const C* s2, nat n1, nat n2) {
00177 ERROR ("not implemented"); }
00178
00179 TMPL static void
00180 pquo_rem (C* dest, C* s1, const C* s2, nat n1, nat n2) {
00181 ERROR ("not implemented"); }
00182
00183 };
00184
00185
00186
00187
00188
00189 template<typename V,typename W>
00190 struct implementation<polynomial_euclidean,V,polynomial_carry_naive<W> >:
00191 public implementation<polynomial_divide,V>
00192 {
00193 typedef implementation<polynomial_divide,V> Pol;
00194 typedef implementation<vector_linear,V> Vec;
00195
00196 TMPL static void
00197 euclidean_sequence (const C* s1, const C* s2, nat n1, nat n2,
00198 C* d1, C* d2, nat& m1 , nat& m2,
00199 C* u1, C* u2, nat& nu1, nat& nu2,
00200 C* v1, C* v2, nat& nv1, nat& nv2,
00201 nat* n, C* rho, C* q, C** r, C** co1, C** co2, nat k= 0) {
00202 ERROR ("not implemented"); }
00203
00204 TMPL static void
00205 gcd (C* g, nat& n, const C* s1, const C* s2, nat n1, nat n2,
00206 C* u1, C* u2, nat& nu1, nat& nu2) {
00207 ERROR ("not implemented"); }
00208
00209 TMPL static void
00210 reconstruct (C* r, C* t, const C* s, nat m, const C* p, nat n, nat k) {
00211 ERROR ("not implemented"); }
00212
00213 };
00214
00215
00216
00217
00218
00219 template<typename V,typename W>
00220 struct implementation<polynomial_gcd,V,polynomial_carry_naive<W> >:
00221 public implementation<polynomial_divide,V>
00222 {
00223 typedef implementation<polynomial_euclidean,V> Pol;
00224 typedef implementation<vector_linear,V> Vec;
00225
00226 TMPLP static Polynomial
00227 gcd (const Polynomial& P1, const Polynomial& P2,
00228 Polynomial& U1, Polynomial& U2) {
00229 ERROR ("not implemented"); }
00230
00231 TMPLP static Polynomial
00232 gcd (const Polynomial& P1, const Polynomial& P2) {
00233 ERROR ("not implemented"); }
00234
00235 TMPLP static inline Polynomial
00236 lcm (const Polynomial& P1, const Polynomial& P2) {
00237 ERROR ("not implemented"); }
00238
00239 TMPLP static Polynomial
00240 invert_mod (const Polynomial& P, const Polynomial& Q) {
00241 ERROR ("not implemented"); }
00242
00243 TMPLP static void
00244 reconstruct (const Polynomial& P, const Polynomial& Q, nat k,
00245 Polynomial& Num, Polynomial &Den) {
00246 ERROR ("not implemented"); }
00247
00248 };
00249
00250 #undef TMPL
00251 #undef TMPLK
00252 #undef TMPLX
00253 #undef TMPLP
00254 #undef Vector
00255 }
00256 #endif //__MMX__POLYNOMIAL_CARRY_NAIVE__HPP