algebramix_doc 0.3
/Users/mourrain/Devel/mmx/algebramix/include/algebramix/crt_polynomial.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : crt_polynomial.hpp
00004 * DESCRIPTION: Crt support for polynomials
00005 * COPYRIGHT  : (C) 2009  Gregoire Lecerf
00006 *******************************************************************************
00007 * This software falls under the GNU general public license and comes WITHOUT
00008 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
00009 * If you don't have this file, write to the Free Software Foundation, Inc.,
00010 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00011 ******************************************************************************/
00012 
00013 #ifndef __MMX_CRT_POLYNOMIAL_HPP
00014 #define __MMX_CRT_POLYNOMIAL_HPP
00015 #include <algebramix/modular_polynomial.hpp>
00016 #include <algebramix/crt_blocks.hpp>
00017 namespace mmx {
00018 
00019 /******************************************************************************
00020 * Default moduli sequence
00021 ******************************************************************************/
00022 
00023 struct coprime_moduli_sequence_polynomial {
00024   template<typename C, typename V, typename W, typename Z> static bool
00025   extend (vector<modulus<polynomial<C,V>, W>, Z>& v, nat k) {
00026     static polynomial<C,V> x (C(1), 1);
00027     for (nat i= N(v); i < k; i++) {
00028         if (i != 0 && C (i) == 0) return false;
00029         v << modulus<polynomial<C,V>, W> (x - C (i));
00030     }
00031     return true; }
00032 };
00033 
00034 template<typename C, typename V, typename W>
00035 struct coprime_moduli_helper<modulus<polynomial<C,V>, W> > {
00036   typedef coprime_moduli_sequence_polynomial sequence;
00037 };
00038 
00039 /******************************************************************************
00040 * Default transformer
00041 ******************************************************************************/
00042 
00043 #define Crt_polynomial_transformer(P)\
00044   crt_blocks_transformer<\
00045                          crt_naive_transformer<P>,\
00046                          crt_dicho_transformer<P> >
00047 
00048 template<typename C, typename V>
00049 struct threshold_helper<polynomial<C,V>,crt_blocks_threshold> {
00050   typedef fixed_value<nat,32> impl;
00051 };
00052 
00053 } // namespace mmx
00054 #endif // __MMX_CRT_POLYNOMIAL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines