realroot_doc 0.1.1
|
00001 #ifndef realroot_MPOLDSE_EENV_H 00002 #define realroot_MPOLDSE_EENV_H 00003 #include <realroot/sparse_monomials.hpp> 00004 00005 namespace mmx { 00006 00007 namespace tensor 00008 { 00009 struct eenv 00010 { 00011 void construct( int nvr_, int const * szs_, int const * vrs_, int * mem ); 00012 static int msz( int nvr_ ); 00013 int * szs(); 00014 int * szs_data(); 00015 int * str(); 00016 int * vrs(); 00017 void cstr(); 00018 void cvrs(); 00019 int * alloc( int nvr_ ); 00020 void dealloc(); 00021 static eenv& copy(eenv& e, const eenv& b ); 00022 static void new_copy(eenv& e, const eenv& b ); 00023 eenv& cdup(); 00024 /* 00025 struct vr_t 00026 { 00027 int v,r; bool operator<( const vr_t& gv ) const { return v < gv.v; }; 00028 bool operator==( int gv ) const { return v == gv; }; 00029 vr_t() {}; 00030 vr_t( int _v, int _r ) :v(_v), r(_r) {}; 00031 }; 00032 vr_t * gvr(); 00033 const 00034 vr_t * gvr() const; 00035 */ 00036 00037 int * data; 00038 00039 public: 00041 int nvr() const; 00043 int const * szs() const; 00045 int const * str() const; 00047 int const * vrs() const; 00049 int sz () const; 00051 int sz ( int v ) const; 00053 int st ( int v ) const; 00055 int vr ( int lv ) const; 00058 bool hasvar( int& lv, int gv ) const; 00060 int msz() const; 00061 int localv( int i ) const { return i; }; 00062 int vridx( int i ) const { 00063 int j; 00064 for(j=0;j< nvr() && vrs()[j]!= i;j++) {} 00065 return j; }; 00066 00067 int mxvr() const { return vrs()[nvr()-1]; }; 00068 int mnvr() const { return vrs()[0]; }; 00069 00070 00072 eenv() : data(0) {}; 00073 template<class C, class O> eenv( const sparse::monomial_seq<C,O>& mpl ); 00074 eenv( int * data ); 00077 eenv( int nvr_, int const * szs_ = 0, int const * vrs_ = 0, int * mem = 0 ); 00079 eenv( const eenv& e ); 00080 eenv& operator=( const eenv& e ); 00081 void swap( eenv& e ); 00082 ~eenv(); 00083 static eenv mrgvrs( const eenv& a, const eenv& b ); 00084 /* new environement that can represent a and b */ 00085 static eenv common( const eenv& a, const eenv& b ); 00086 /* new environment (can represent a * b) */ 00087 static eenv mul ( const eenv& a, const eenv& b ); 00088 /* new environment that can represent. diff(b,lv) */ 00089 static eenv diff( const eenv& b, int lv ); 00090 bool operator<( const eenv& b ) const; 00091 00093 static bool vmap( int * vmap, const eenv& o, const eenv& i ); 00095 static bool oaddress( const eenv& oenv, unsigned * osupp, 00096 const eenv& ienv, unsigned * isupp = 0 ,unsigned nsp = 0 ); 00097 friend std::ostream& operator<<( std::ostream& o, const eenv& env ); 00098 //friend std::ostream& operator<<( std::ostream& o, const vr_t& v ); 00099 static bool equiv( const eenv& a, const eenv& b ); 00100 static bool equal( const eenv& a, const eenv& b ); 00101 bool operator==( const eenv& a ) const; 00102 bool operator!=( const eenv& a ) const; 00103 static bool subset( const eenv& a, const eenv& b ); 00104 static eenv elevation( const eenv& a, const eenv& b ); 00105 void vswap( int * perm ); 00106 static eenv rewrite( const eenv&o, const eenv& i ); 00107 }; 00108 } 00109 00110 } //namespace mmx 00111 00112 #include "tensor_eenv_fcts.hpp" 00113 #include "tensor_eenv_loops.hpp" 00114 00115 #endif