realroot_doc 0.1.1
/Users/mourrain/Devel/mmx/realroot/include/realroot/ring.hpp
Go to the documentation of this file.
00001 # ifndef realroot_ring_hpp
00002 # define realroot_ring_hpp
00003 # include <realroot/variables.hpp>
00004 # define TMPL template<class C, class B, class O>
00005 # define SELF ring<C,B,O>
00006 
00037 //====================================================================
00038 #include <realroot/texp_bool.hpp>
00039 #include <realroot/monomial_ordering.hpp>
00040 #include <realroot/variables.hpp>
00041 //====================================================================
00042 namespace mmx {
00043   template<class C, class V> struct with;
00044   template<class C, class V> struct polynomial;
00045 
00047   template<class C, class B, class O=B>
00048   struct ring {
00049 
00050     typedef polynomial<C, with<B,O> >  Polynomial;
00051     
00052     ring(){}
00053     ring(const SELF& r){}
00054     ring(const char* s) {var = variables(s); }
00055     
00056     Polynomial  operator[](int i) const {
00057       return Polynomial((C)1,1,i);
00058     }
00059     
00060     static int nbvar() { return var.nbvar(); }
00061     
00062     static variables var;
00063     static variables& vars () { return var;}
00064   
00065   };
00066   TMPL variables SELF::var;
00067 
00069   TMPL C sample (const SELF& R) { return (C)0; }
00070   //====================================================================  
00071 
00072 
00073 
00074   template<class V> struct default_variant_of {
00075     typedef V Variant;
00076   } ;
00077 
00078 //   /**     
00079 //    \brief Generic ring class. 
00080 
00081 //   **/ 
00082 //   template<class C, class V, class W = typename default_variant_of<V>::Variant > 
00083 //   struct ring {
00084 //     typedef texp::null_t   rep_t;
00085 //     typedef C              Scalar;
00086 //   };
00087   
00088   //--------------------------------------------------------------------
00089   template<class U> struct ring_of;
00090   template<class C, class V> struct polynomial;
00091   template<class C, class V> 
00092   struct ring_of< polynomial<C,V> > { 
00093     typedef ring<C, V> Ring;
00094   };
00095 
00096   template<class C, class V, class W> 
00097   struct ring_of< polynomial<C,with<V,W> > > { 
00098     typedef ring<C, V, W> Ring;
00099   };
00100 
00101 }
00102 //====================================================================
00103 #undef TMPL
00104 #undef SELF
00105 //====================================================================
00106 #endif //realroot_ring_hpp