00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 # ifndef shape_algebraic_set_hpp
00013 # define shape_algebraic_set_hpp
00014
00015 # include <realroot/GMP.hpp>
00016 # include <realroot/ring_sparse.hpp>
00017 # include <shape/shape.hpp>
00018 # define TMPL template<class C, class V>
00019 # define TMPL1 template<class V>
00020 # define SELF algebraic_set<C,V>
00021
00022 namespace mmx { namespace shape {
00023
00025 struct numeric_def {};
00026
00028 template<> struct use<numeric_def>
00029 {
00030 typedef ::mmx::GMP::integer Integer;
00031 typedef ::mmx::GMP::rational Rational;
00032 typedef ::mmx::GMP::floating Floating;
00033 };
00034
00036 struct algebraic_set_def {};
00037
00039 template<class C> struct use<algebraic_set_def, C>
00040 {
00042 typedef use<numeric_def>::Rational Scalar;
00043
00045 typedef polynomial<Scalar, with<Sparse, DegRevLex> > Polynomial;
00046 };
00047
00048
00049 TMPL
00050 class algebraic_set
00051 {
00052 public:
00053 typedef typename use<algebraic_set_def, C, V>::Polynomial Polynomial;
00054
00055 algebraic_set(void) {};
00056 algebraic_set(const char* s1) ;
00057 algebraic_set(const char* s1, const char* s2) ;
00058 algebraic_set(const Polynomial& eq) ;
00059 algebraic_set(const Polynomial& eq1, const Polynomial& eq2) ;
00060 ~algebraic_set(void) {};
00061
00062 const Seq<Polynomial>& equations() const { return this->m_polynomials ; }
00063 const Polynomial& equation(int i=0) const { return this->m_polynomials[i] ; }
00064 Polynomial& equation(int i=0) { return this->m_polynomials[i] ; }
00065 void set_equation(const Polynomial& p) { this->m_polynomials[0]=p ; }
00066 void insert(const Polynomial& p) { this->m_polynomials<<p; }
00067 int nbequation() const { return m_polynomials.size(); }
00068
00069 private:
00070 Seq<Polynomial> m_polynomials ;
00071 } ;
00072
00073 TMPL
00074 SELF::algebraic_set(const char* s1) {
00075 m_polynomials<<Polynomial(s1);
00076 }
00077
00078 TMPL
00079 SELF::algebraic_set(const char* s1,const char* s2) {
00080 m_polynomials<<Polynomial(s1);
00081 m_polynomials<<Polynomial(s2);
00082 }
00083
00084 TMPL
00085 SELF::algebraic_set(const Polynomial& p1) {
00086 m_polynomials<<p1;
00087 }
00088
00089 TMPL
00090 SELF::algebraic_set(const Polynomial& p1,const Polynomial& p2) {
00091 m_polynomials<<p1;
00092 m_polynomials<<p2;
00093 }
00094
00095
00096 } ;
00097 } ;
00098
00099 # undef TMPL
00100 # undef TMPL1
00101 # undef SELF
00102 # endif // IMPLICITCURVE_H