Developer documentation

tensor_eenv.hpp
Go to the documentation of this file.
1 #ifndef realroot_MPOLDSE_EENV_H
2 #define realroot_MPOLDSE_EENV_H
4 
5 namespace mmx {
6 
7 namespace tensor
8 {
9  struct eenv
10  {
11  void construct( int nvr_, int const * szs_, int const * vrs_, int * mem );
12  static int msz( int nvr_ );
13  int * szs();
14  int * szs_data();
15  int * str();
16  int * vrs();
17  void cstr();
18  void cvrs();
19  int * alloc( int nvr_ );
20  void dealloc();
21  static eenv& copy(eenv& e, const eenv& b );
22  static void new_copy(eenv& e, const eenv& b );
23  eenv& cdup();
24  /*
25  struct vr_t
26  {
27  int v,r; bool operator<( const vr_t& gv ) const { return v < gv.v; };
28  bool operator==( int gv ) const { return v == gv; };
29  vr_t() {};
30  vr_t( int _v, int _r ) :v(_v), r(_r) {};
31  };
32  vr_t * gvr();
33  const
34  vr_t * gvr() const;
35  */
36 
37  int * data;
38 
39  public:
41  int nvr() const;
43  int const * szs() const;
45  int const * str() const;
47  int const * vrs() const;
49  int sz () const;
51  int sz ( int v ) const;
53  int st ( int v ) const;
55  int vr ( int lv ) const;
58  bool hasvar( int& lv, int gv ) const;
60  int msz() const;
61  int localv( int i ) const { return i; };
62  int vridx( int i ) const {
63  int j;
64  for(j=0;j< nvr() && vrs()[j]!= i;j++) {}
65  return j; };
66 
67  int mxvr() const { return vrs()[nvr()-1]; };
68  int mnvr() const { return vrs()[0]; };
69 
70 
72  eenv() : data(0) {};
73  template<class C, class O> eenv( const sparse::monomial_seq<C,O>& mpl );
74  eenv( int * data );
77  eenv( int nvr_, int const * szs_ = 0, int const * vrs_ = 0, int * mem = 0 );
79  eenv( const eenv& e );
80  eenv& operator=( const eenv& e );
81  void swap( eenv& e );
82  ~eenv();
83  static eenv mrgvrs( const eenv& a, const eenv& b );
84  /* new environement that can represent a and b */
85  static eenv common( const eenv& a, const eenv& b );
86  /* new environment (can represent a * b) */
87  static eenv mul ( const eenv& a, const eenv& b );
88  /* new environment that can represent. diff(b,lv) */
89  static eenv diff( const eenv& b, int lv );
90  bool operator<( const eenv& b ) const;
91 
93  static bool vmap( int * vmap, const eenv& o, const eenv& i );
95  static bool oaddress( const eenv& oenv, unsigned * osupp,
96  const eenv& ienv, unsigned * isupp = 0 ,unsigned nsp = 0 );
97  friend std::ostream& operator<<( std::ostream& o, const eenv& env );
98  //friend std::ostream& operator<<( std::ostream& o, const vr_t& v );
99  static bool equiv( const eenv& a, const eenv& b );
100  static bool equal( const eenv& a, const eenv& b );
101  bool operator==( const eenv& a ) const;
102  bool operator!=( const eenv& a ) const;
103  static bool subset( const eenv& a, const eenv& b );
104  static eenv elevation( const eenv& a, const eenv& b );
105  void vswap( int * perm );
106  static eenv rewrite( const eenv&o, const eenv& i );
107  };
108 }
109 
110 } //namespace mmx
111 
112 #include "tensor_eenv_fcts.hpp"
113 #include "tensor_eenv_loops.hpp"
114 
115 #endif
static eenv mul(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:246
static bool oaddress(const eenv &oenv, unsigned *osupp, const eenv &ienv, unsigned *isupp=0, unsigned nsp=0)
addresses translation from environment i to environment o
Definition: tensor_eenv_fcts.hpp:295
const C & b
Definition: Interval_glue.hpp:25
bool operator==(const eenv &a) const
Definition: tensor_eenv_fcts.hpp:356
int * szs()
Definition: tensor_eenv_fcts.hpp:12
static bool equal(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:74
static eenv elevation(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:366
static bool equiv(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:474
friend std::ostream & operator<<(std::ostream &o, const eenv &env)
Definition: tensor_eenv_fcts.hpp:325
void construct(int nvr_, int const *szs_, int const *vrs_, int *mem)
Definition: tensor_eenv_fcts.hpp:40
eenv()
constructors
Definition: tensor_eenv.hpp:72
static bool subset(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:344
void dealloc()
Definition: tensor_eenv_fcts.hpp:83
static eenv common(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:211
int * vrs()
Definition: tensor_eenv_fcts.hpp:18
int * str()
Definition: tensor_eenv_fcts.hpp:21
Definition: tensor_eenv.hpp:9
int localv(int i) const
Definition: tensor_eenv.hpp:61
void swap(eenv &e)
Definition: tensor_eenv_fcts.hpp:7
int mnvr() const
Definition: tensor_eenv.hpp:68
static eenv rewrite(const eenv &o, const eenv &i)
Definition: tensor_eenv_fcts.hpp:480
int vr(int lv) const
return the global id for variable lv
Definition: tensor_eenv_fcts.hpp:26
int * szs_data()
Definition: tensor_eenv_fcts.hpp:13
int nvr() const
number of variables
Definition: tensor_eenv_fcts.hpp:9
int * alloc(int nvr_)
Definition: tensor_eenv_fcts.hpp:33
int vridx(int i) const
Definition: tensor_eenv.hpp:62
eenv & cdup()
Definition: tensor_eenv_fcts.hpp:95
void vswap(int *perm)
static eenv diff(const eenv &b, int lv)
Definition: tensor_eenv_fcts.hpp:270
void cstr()
Definition: tensor_eenv_fcts.hpp:117
int sz() const
return the total number of coefficients of the dense representation
Definition: tensor_eenv_fcts.hpp:16
static bool vmap(int *vmap, const eenv &o, const eenv &i)
variable names translation from environment i to environment o
Definition: tensor_eenv_fcts.hpp:280
bool operator!=(const eenv &a) const
Definition: tensor_eenv_fcts.hpp:361
static eenv & copy(eenv &e, const eenv &b)
Definition: tensor_eenv_fcts.hpp:85
static eenv mrgvrs(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:162
int * data
Definition: tensor_eenv.hpp:37
eenv & operator=(const eenv &e)
Definition: tensor_eenv_fcts.hpp:161
int st(int v) const
return the stride for variable v
Definition: tensor_eenv_fcts.hpp:24
bool operator<(const eenv &b) const
Definition: tensor_eenv_fcts.hpp:31
static void new_copy(eenv &e, const eenv &b)
Definition: tensor_eenv_fcts.hpp:108
int msz() const
memory size used by the eenv representation in bytes.
Definition: tensor_eenv_fcts.hpp:29
bool hasvar(int &lv, int gv) const
Definition: tensor_eenv_fcts.hpp:131
Definition: array.hpp:12
int mxvr() const
Definition: tensor_eenv.hpp:67
~eenv()
Definition: tensor_eenv_fcts.hpp:149
Home