00001
00002
00003
00004
00005 #ifndef SYNAPS_MPOL_Ideal_h
00006 #define SYNAPS_MPOL_Ideal_h
00007
00008 #include <stdlib.h>
00009 #include <string>
00010 #include <list>
00011 #include <synaps/init.h>
00012 #include "synaps/base/Seq.h"
00013 #include "synaps/mpol/MPol.h"
00014
00015
00016 __BEGIN_NAMESPACE_SYNAPS
00017
00018 namespace linalg { template<class C> struct rep1d; }
00019
00020 template <class C,
00021 class R=MPol<C> >
00022 struct Ideal : public Seq<R> {
00023
00024
00025 typedef C coeff_t;
00026 typedef typename Seq<R>::iterator iterator;
00027 typedef typename Seq<R>::const_iterator const_iterator;
00028 typedef typename Seq<R>::reverse_iterator reverse_iterator;
00029 typedef typename Seq<R>::const_reverse_iterator const_reverse_iterator;
00030 typedef R poly_t;
00031 typedef Ideal<C,R> self_t;
00032
00033
00034 Ideal():Seq<R>() {this->resize(0);}
00035 Ideal(const poly_t& p):Seq<RR>() {this->push_back(p);}
00036 Ideal(const self_t & I):Seq<R>(I){}
00037 Ideal(int n, poly_t* t):Seq<R>(n,t){}
00038 Ideal(const Seq<R>& s):Seq<R>(s){}
00039
00040
00041
00042
00043
00044
00045
00046 self_t & operator =(const self_t & x) {this->operator=(x); return *this;}
00047
00048
00049 };
00050
00051 template<class C, class R> const Seq<R>& As_Seq(const Ideal<C,R>& x)
00052 { return *((const Seq<R>*)&x); };
00053
00054 template<class C,class R>
00055 Ideal<C,R> operator+(const Ideal<C,R>& a, const Ideal<C,R> & b)
00056 {
00057 return (Ideal<C,R>)((Seq<R>)(a)+(Seq<R>)(b));
00058 }
00059
00060 template<class C, class R>
00061 Ideal<C,R> operator*(const Ideal<C,R>& I1, const Ideal<C,R>& I2)
00062 {
00063 Ideal<C,R> res;
00064 for(unsigned i=0; i<I1.size();i++)
00065 for(unsigned j=0; j<I2.size();j++)
00066 res.push_back(I1[i]*I2[j]);
00067 return res;
00068 }
00069 __END_NAMESPACE_SYNAPS
00070
00071 #endif // SYNAPS_MPOL_MPOL_H
00072