Developer documentation

tensor_monomials_fcts.hpp
Go to the documentation of this file.
1 #ifndef realroot_MPOLDSE_MONOMIAL_C
2 #define realroot_MPOLDSE_MONOMIAL_C
3 
4 #include <realroot/monomial.hpp>
7 #include <iostream>
8 namespace mmx {
9 
10 #ifndef MMX_WITH_PLUS_SIGN
11 #define MMX_WITH_PLUS_SIGN
12  template<class X> inline bool with_plus_sign(const X& x) {return x>0;}
13 
14  template<class C> inline bool with_plus_sign(const tensor::monomials<C>& x) {
15  return true;
16  }
17 #endif //MMX_WITH_PLUS_SIGN
18 
19 namespace tensor
20 {
21  template < class C > inline
23  // int szs = 1; new (this) monomials (1, &szs); data[0] = (C)0;
24  int *szs = new int, *vrs= new int;
25  szs[0] = 1;
26  vrs[0] = 0;
27  env = eenv(1, szs, vrs);
28  data = vector_type (env.sz(),(C)0);
29  data[0] = (C)0;
30  }
31  template < class C > inline
32  monomials < C >::monomials (const eenv & e)//:env (e), data (e.sz ()) {}
33  {
34  env = e;
35  data = vector_type (e.sz());
36  };
37  template < class C > inline
38  monomials < C >::monomials (const eenv & e, const C & c)//:env(e),data (e.sz (), c) {};
39  {
40  env = e;
41  data = vector_type (e.sz(),c);
42  };
43  template < class C > inline
45  {
46  int *szs = new int, *vrs= new int;
47  szs[0] = d+1;
48  vrs[0] = v;
49  env = eenv(1, szs, vrs);
50  data = vector_type (env.sz(),(C)0);
51  data[env.sz()-1]= 1;
52  }
53 
54  template < class C > inline
55  monomials < C >::monomials (const C& c, int d, unsigned v)
56  {
57  assert(d>=0);
58  int *szs = new int, *vrs= new int;
59  szs[0] = d+1;
60  vrs[0] = v;
61  env = eenv(1, szs, vrs);
62  data = vector_type (env.sz(),(C)0);
63  data[env.sz()-1]= c;
64  }
65 
66  template < class C > inline
67  monomials < C >::monomials (int nvr, const int *szs, const int *vrs) //:env (nvr, szs, vrs),data (env.sz(),(C)0)
68  {
69  env = eenv(nvr, szs, vrs);
70  data = vector_type (env.sz(),(C)0);
71  };
72  template < class C > inline
74  { int szs = 1; new (this) monomials (1, &szs); data[0] = x; }
75 
76  template < class C >
77  void realloc (monomials < C > &mpl, const eenv & nenv)
78  {
79  if (!eenv::equal (mpl.env, nenv ))
80  {
81  monomials< C > tmp (nenv);
82  mpl.swap (tmp);
83  };
84  };
85 
86  template < class C > inline
87  void clear ( monomials < C >& monoms ) { std::fill(monoms.begin(),monoms.end(),C(0)); };
88  template < class C > inline
89  void clear ( monomials < C > &mpl, const eenv & nenv)
90  {
91  if (mpl.env != nenv) {
92  monomials < C > tmp (nenv, C (0));
93  mpl.swap (tmp);
94  } else
95  clear(mpl);
96  };
97 
98  template < class C >
99  bool varindex (int &lv, const monomials<C>& mpl, int gv)
100  {
101  return mpl.env.hasvar (lv, gv);
102  }
103 
104  template < class C > bool monomials < C >::operator== (const monomials & mpl) const
105  {
106  if (!eenv::equal (env, mpl.env))
107  return false;
108  unsigned *oadd = new unsigned[esz ()];
109  eenv::oaddress (env, oadd, mpl.env, 0, 0);
110  for (int i = 0; i < esz (); i++)
111  if (data[i] != mpl[oadd[i]])
112  {
113  delete[]oadd;
114  return false;
115  };
116  delete[]oadd;
117  return true;
118  };
119 
120  template < class C >
121  std::ostream & operator<< (std::ostream & o, const monomials < C > &mpl)
122  {
123  o << "monomials object:\n";
124  o << "\t(addresses) o: " << &mpl << " e: " << mpl.env.data << "d: " << mpl.
125  begin () << std::endl;
126  o << "\t(eenv)" << mpl.env << std::endl;
127  o << "\t(data)";
128  array::print (o, mpl.data);
129  o << std::endl;
130  o << ":object monomials\n";
131  return o;
132  };
133  template < class Result, class Coeff, class Parameters > inline
134  void eval (Result & result, const monomials < Coeff > & monoms , const Parameters & parameters )
135  {
136  // if (monoms.nbvar()==1)
137  vct::horner(result, monoms.begin (), monoms.size(), parameters, 1);
138  // levalm( result, monoms.begin (), monoms.env, parameters );
139  };
140  template < class Result, class Coeff, class Parameters > inline
141  void eval (Result & result, const monomials < Coeff > & monoms , const Parameters & parameters , unsigned n)
142  {
143  //assert(parameters.size()<n);
144  levalm( result, monoms.begin (), monoms.env, parameters );
145  };
146 
147  template < class Result, class Coeff, class Parameters > inline
148  void heval (Result & result, const monomials < Coeff > & monoms , const Parameters & parameters)
149  {
150  hevalm( result, monoms.begin (), monoms.env, parameters );
151  };
152 
153  template < class Result, class Coeff, class Parameters > inline
154  void subs0 (Result *result, const monomials < Coeff > & monoms , const Parameters & parameters )
155  {
156  subs0m( result, monoms.begin (), monoms.env, parameters );
157  };
158 
159  template < class C >
160  void extend (monomials < C > &mpl, const eenv & nenv)
161  {
162  if ( mpl.env != nenv )
163  {
164  unsigned *oadd = new unsigned[mpl.esz ()];
165  eenv::oaddress (nenv, oadd, mpl.env, 0, 0);
166  monomials < C > tmp (nenv);
167  vct::icopy (tmp.begin (), oadd, mpl.esz (), mpl.begin ());
168  delete[]oadd;
169  mpl.swap (tmp);
170  };
171  };
172 
173  // addition optimisable ...(mais pas maintenant)
174  template < class X, class Y >
175  void waddm (monomials < X > &mpla, const monomials < Y > &mplb)
176  {
177  assert (eenv::subset (mplb.env, mpla.env));
178  unsigned *oadd = new unsigned[mplb.esz ()];
179  eenv::oaddress (mpla.env, oadd, mplb.env, 0, 0);
180  vct::ipadd (mpla.begin (), oadd, mplb.esz (), mplb.begin ());
181  delete[]oadd;
182  };
183 
184  template < class X, class C > inline void
185  add (monomials < X > &r, const monomials < X > &a, const C& c ) {
186  add(r=a,c);
187  }
188 
189  template < class C > inline void
190  add (monomials < C > &a, const C & x) {
191  a[0] += x;
192  }
193 
194  template < class C > void
195  add (monomials < C > &r, const C & c, const monomials < C > &a) {
196  add(r,a,c);
197  }
198 
199  template < class C > inline
200  void add (monomials < C > &r, const monomials < C > &a)
201  {
202  extend (r, eenv::common (r.env, a.env));
203  waddm (r, a);
204  }
205 
206  template < class C > inline
208  {
209  if ( &r == &a ) { add(r,b); return; };
210  if ( &r == &b ) { add(r,a); return; };
211  realloc(r,eenv::common(a.env,b.env));
212  unsigned *oadd = new unsigned[std::max(a.esz (),b.esz())];
213  eenv::oaddress (r.env, oadd,a.env, 0, 0);
214  vct::icopy(r.begin(),oadd,a.esz(),a.begin());
215  eenv::oaddress(r.env,oadd,b.env,0,0);
216  vct::ipadd (r.begin (), oadd,b.esz (), b.begin ());
217  };
218 
219  template < class C > inline
221  {
222  if ( &r == &a ) { sub(r,b); return; };
223  if ( &r == &b ) { monomials<C> tmp = b; sub(r,a,tmp); return; };
224 
225  realloc(r,eenv::common(a.env,b.env));
226  unsigned *oadd = new unsigned[std::max(a.esz (),b.esz())];
227  eenv::oaddress (r.env, oadd,a.env, 0, 0);
228  vct::icopy(r.begin(),oadd,a.esz(),a.begin());
229  eenv::oaddress(r.env,oadd,b.env,0,0);
230  vct::ipsub (r.begin (), oadd,b.esz (), b.begin ());
231  };
232 
233  template < class C > inline void
234  sub (monomials < C > &mpl, const C & c, const monomials < C > &a) {
235  add(mpl,a,-c);
236  }
237  template < class X, class Y >
238  void wsubm (monomials < X > &mpla, const monomials < Y > &mplb)
239  {
240  assert (eenv::subset (mplb.env, mpla.env));
241  unsigned *oadd = new unsigned[mplb.esz ()];
242  eenv::oaddress (mpla.env, oadd, mplb.env, 0, 0);
243  vct::ipsub (mpla.begin (), oadd, mplb.esz (), mplb.begin ());
244  delete[]oadd;
245  };
246 
247  template < class X, class Y > inline
248  void sub (monomials < X > &r, const monomials < Y > &a)
249  {
250  extend (r, eenv::common (r.env, a.env)), wsubm (r, a);
251  }
252 
253 
254  template < class X, class C > inline void
255  sub (monomials < X > &r, const monomials < X > &a, const C& c )
256  {
257  r=a;sub(r,c);
258  }
259  template < class C , class X> inline
260  void sub (monomials < C > &a, const X & x)
261  {
262  a[0] -= (C)x;
263  }
264 
265  template < class C > void mul (monomials < C > &r, const C & c)
266  {
267  vct::scmul (r.begin (), c, r.esz (), 1);
268  };
269 
270  template < class C > void div (monomials < C > &r, const C & c)
271  {
272  vct::scdiv (r.begin (), c, r.esz (), 1);
273  };
274 
275  template < class C > void mul (monomials < C > &r, const monomials < C > &a)
276  {
277  // monomials<C> s(r);
278  conv(r,a);
279  };
280 
281 
282  template < class X, class Y, class Z > inline
284  {
285  conv(r,a,b);
286  };
287 
288  template < class C > inline
289  void mul (monomials < C > &a, const monomials < C > &b, const C & c)
290  {
291  mul (a = b, c);
292  };
293 
294  template < class C > inline void
295  mul (monomials < C > &r, const C &c, const monomials < C > &a) {
296  mul(r=a,c);
297  };
298 
299  template < class C > inline void
300  div (monomials < C > &r, const monomials < C > &a, const C &c) {
301  div(r=a,c);
302  }
303 
304  template<class OSTREAM, class C> OSTREAM&
305  print( OSTREAM& os, const monomials<C>& mpl, const variables& Var = monom<C>::var) {
306  typedef monom<C> monom_t;
307  typedef typename monom<C>::container_t exponent_t;
308  exponent_t tmp (mpl.env.mxvr()+1);
309  const int *szs = mpl.szs ();
310  const int *vrs = mpl.vrs ();
311  bool notfirst = false;
312  for (int i = 0; i < mpl.size(); i++)
313  if (mpl[i] != 0)
314  {
315  int a, v;
316  for (a = i, v = mpl.nvr () - 1; a; a /= szs[v], v--)
317  tmp[vrs[v]] = a % szs[v];
318  std::ostringstream sm;
319  print(sm, monom_t (mpl[i], tmp), Var);
320  //bool is_pol = is_polynomial(sm);
321  if ( sm.str()[0]!='-' && sm.str()[0]!='+' && notfirst) {
322  os <<'+';
323  }
324  os<<sm.str().c_str();
325  notfirst=true;
326  };
327  if(!notfirst) os << "0";
328  return os;
329  }
330 
331  template<class SYNTAX, class C> void
332  print_flatten( SYNTAX& out, const monomials<C>& mpl, const variables& Var = monom<C>::var) {
333  //typedef monom<C> monom_t;
334  typedef typename monom<C>::container_t exponent_t;
335  exponent_t tmp (mpl.env.mxvr()+1);
336  const int *szs = mpl.szs ();
337  const int *vrs = mpl.vrs ();
338  for (int i = 0; i < mpl.size(); i++)
339  if (mpl[i] != 0)
340  {
341  int a, v;
342  for (a = i, v = mpl.nvr () - 1; a; a /= szs[v], v--)
343  tmp[vrs[v]] = a % szs[v];
344 
345  SYNTAX m = flatten(mpl[i]);
346  for(int i=0;i<mpl.env.mxvr()+1;i++)
347  m = m * pow(SYNTAX(Var[i].data()),flatten(tmp[i]));
348  out+=m;
349  }
350  }
351 
352 
353  template<class Coeff> inline int
355  int d=0;
356  for(int i=0;i<p.nbvar();i++) d+= *(p.env.szs()+i)-1;
357  return d;
358  }
359 
360  template<class Coeff> inline int
361  degree(const monomials<Coeff>& p, int v) {
362  return p.env.sz(v)-1;
363  }
364 
365 
366  template<class Coeff> inline int
368  return 0;
369  }
370 
371  template<class Coeff> inline void
372  diff( monomials<Coeff>& res, const monomials<Coeff>& src, int v ) {
373  clear( res, eenv::diff(src.env,v));
374  // mdiff( res.begin(), res.env, src.begin(), src.env, v );
375  mdiff( res.begin(), res.env, src.begin(), src.env, v );
376  }
377 
378  template < class C >
379  template < class X, class O>
380  monomials < C >::monomials (const sparse::monomial_seq< X, O > &imp)
381  {
382  env= eenv(imp);
383  data= vector_type(env.sz (), (C)0);
384  // const int *vr = this->vrs ();
385  // const int *st = this->str ();
386  // const int nvr = this->nvr();
387  // C *data = this->begin ();
388  mpolfill(this->begin(),imp,env);
389  };
390 
391  template < class C, class O>
392  void convert (monomials < C > &mpl, const sparse::monomial_seq< C, O> &imp)
393  {
394  mpl. ~ monomials < C > ();
395  new (&mpl) monomials<C>(imp);
396  };
397 
398  template < class C, class O> void
399  convert (sparse::monomial_seq< C, O> &pol, const monomials < C > &mpl) {
400  typedef typename sparse::monomial_seq< C, O>::monom_t monom_t;
401  typedef typename monom_t::container_t container_t;
402  add(pol,C(0));
403  container_t tmp (mpl.env.mxvr()+1);
404  const int *szs = mpl.szs ();
405  const int *vrs = mpl.vrs ();
406  for (int i = 0; i < mpl.size(); i++)
407  if (mpl[i] != 0)
408  {
409  int a, v;
410  for (a = i, v = mpl.nvr () - 1; a; a /= szs[v], v--)
411  tmp[vrs[v]] = a % szs[v];
412  add(pol, monom_t (mpl[i], tmp));
413  };
414  }
415 
416 // inline eenv face( const eenv& e, int lv )
417 // {
418 // const int * eszs = e.szs();
419 // const int * evrs = e.vrs();
420 // const int envr = e.nvr();
421 // int szs[ envr ];
422 // int vrs[ envr ];
423 // int c = 0;
424 // for ( int v = 0; v < envr; v ++ ) if ( v != lv ) { szs[c] = eszs[v]; vrs[c++] = evrs[v]; };//evrs[v]; };
425 // return eenv(c,szs,vrs);
426 // };
427 
428 inline eenv face_env( const eenv& e, int lv ) {
429  const int * eszs = e.szs();
430  const int * evrs = e.vrs();
431  const int envr = e.nvr();
432  int szs[ envr ];
433  int vrs[ envr ];
434  int c = 0;
435  for ( int v = 0; v < envr; v ++ ) if ( v != lv ) { szs[c] = eszs[v]; vrs[c++] = evrs[v]; };//evrs[v]; };
436  return eenv(c,szs,vrs);
437 }
438 
439 template<class C> inline
440 void lface ( monomials<C>& f, const monomials<C>& src, int v )
441 {
442  lface( f.begin(), src.env, src.begin(), v );
443 };
444 
445 template<class C> inline
446 void rface ( monomials<C>& f, const monomials<C>& src, int v )
447 {
448  rface( f.begin(), src.env, src.begin(), v );
449 };
450 
451 
452 template<class C> inline
453 void face ( monomials<C>& f, const monomials<C>& src, int v, int n )
454 {
455  assert(n==0||n==1);
456  eenv fenv(face_env(src.env,src.env.localv(v)));
457  if ( f.env != fenv ) realloc( f, fenv );
458  if ( n ) rface( f, src, src.env.localv(v) );
459  else lface( f, src, src.env.localv(v) );
460 };
461 
462 
463  template<class C> inline
464  void islice( monomials<C>& f, const monomials<C>& src, int v, int i )
465  {
466  slice( f.begin(), src.env, src.begin(), v );
467  }
468 
469  template<class C> inline
470  void slice( monomials<C>& f, const monomials<C>& src, int v, int n )
471  {
472  assert(n==0||n==1);
473  eenv fenv(slice(src.env,src.env.localv(v)));
474  if ( f.env != fenv ) realloc( f, fenv );
475  islice( f, src, src.env.localv(v),n);
476  }
477 
478  template<class C> inline
479  const C monomials<C>::entry(std::vector<int> deg)
480  {
481  int * vvrs = vrs();
482  int * sstr = str();
483  int * sszs = szs() ;
484 
485  int i,pos=0;
486  for (i = 0; i < nvr() ; ++i)
487  {
488  std::cout<<"entry:" <<deg[i] << std::endl;
489  if (deg[i] >= sszs[ vvrs[i] ] || deg[i]<0 ) return C(0);
490  pos += deg[i]*sstr[ vvrs[i] ];
491  }
492  return data[pos];
493  }
494 
496  template<class C> //inline
497  void shift( monomials<C> & f, const C & t, const int & v )
498  {
499  std::vector<int> ind = std::vector<int>( f.nvr() );
500  int s,k,j, i,pos =0;
501 
502  int * vars = f.vrs();
503  int * sstr = f.str();
504  int * sszs = f.szs() ;
505 
506  for (;;)
507  {
508  for ( s = sszs[v], j = 0; j <= s-2; j++ )
509  for( k = s-2; k >= j; k-- )
510  f.data[sstr[v]*k+ pos ] +=
511  t*f.data[ sstr[v]*(1+k)+ pos ];
512 
513  /* next row */
514  for (i = 0; i < f.nvr() ; ++i)
515  {
516  if ( vars[i] != v )
517  {
518  ind[i] += 1;
519  pos += sstr[i];
520  } else continue;
521 
522  if (ind[i] < sszs[i])
523  break;
524  ind[i] = 0;
525  pos -= sszs[i]*sstr[i];
526  }
527  if (i == f.nvr() )
528  break;
529  }
530  }
531 
533  template<class C>
534  void set_variable(monomials<C> & f, C t, int v )
535  {
536  std::vector<int> ind = std::vector<int>( f.nvr() );
537  int k, i, pos =0;
538 
539  int * vars = f.vrs();
540  int * sstr = f.str();
541  int * sszs = f.szs() ;
542  C tmp;
543 
544  for (;;)
545  {
546  tmp=0;
547  for( k = sszs[v]-1; k !=-1; --k )
548  {
549  tmp *= t;
550  tmp += f.data[sstr[v]*k + pos];
551  f.data[sstr[v]*k + pos] = 0 ;
552  }
553  f.data[pos]=tmp;
554 
555  /* next row */
556  for (i = 0; i < f.nvr() ; ++i)
557  {
558  if ( vars[i] != v )
559  {
560  ind[i] += 1;
561  pos += sstr[i];
562  } else continue;
563 
564  if (ind[i] < sszs[i])
565  break;
566  ind[i] = 0;
567  pos -= sszs[i]*sstr[i];
568  }
569  if (i == f.nvr() )
570  break;
571  }
572  }
573 
574 
576  template<class C> //inline
577  void reciprocal( monomials<C> & f, const int & v)
578  {
579  std::vector<int> ind = std::vector<int>( f.nvr() );
580  int s,i,pos =0;
581 
582  int * vars = f.vrs();
583  int * sstr = f.str();
584  int * sszs = f.szs();
585  int l= sszs[v]-1;
586 
587  for (;;)
588  {
589  for ( s = 0 ; s <= l/2; s++ )
590  std::swap(f.data[sstr[v]*s+pos], f.data[sstr[v]*(l-s)+pos] );
591 
592  // next row
593  for (i = 0; i < f.nvr() ; ++i)
594  {
595  if ( vars[i] != v )
596  {
597  ind[i] += 1;
598  pos += sstr[i];
599  } else continue;
600 
601  if (ind[i] < sszs[i])
602  break;
603  ind[i] = 0;
604  pos -= sszs[i]*sstr[i];
605  }
606  if (i == f.nvr() )
607  break;
608  }
609  }
610 
612  template<class C> //inline
613  void contraction( monomials<C> & f, const C & t, const int & v )
614  {
615  std::vector<int> ind = std::vector<int>( f.nvr() );
616  int s,i,pos =0;
617 
618  int * vars = f.vrs();
619  int * sstr = f.str();
620  int * sszs = f.szs();
621 
622  for (;;)
623  {
624  for ( s = 0 ; s < sszs[v]; ++s )
625  f.data[sstr[v]*s+pos] *= pow(t,s) ;
626 
627  // next row
628  for (i = 0; i < f.nvr() ; ++i)
629  {
630  if ( vars[i] != v )
631  {
632  ind[i] += 1;
633  pos += sstr[i];
634  } else continue;
635 
636  if (ind[i] < sszs[i])
637  break;
638  ind[i] = 0;
639  pos -= sszs[i]*sstr[i];
640  }
641  if (i == f.nvr() )
642  break;
643  }
644  };
645 
646  template<class C>
647  void mins( monomials<C> & mm, monomials<C> & f, int v )
648  {
649  int p,k,i,j;
650  int * sszs = f.szs() ;
651  int * sstr = f.str() ;
652 
653  for ( p = 0, k = 0; k < sszs[v]; k++, p += sstr[v] )
654  {
655  mm.data[k] = f.data[p];
656  for ( i = 0; i < f.size(); i += sstr[v-1] )
657  for ( j = i; j < i + sstr[v]; j ++ )
658  if ( f.data[j+p] < mm[k] ) mm[k] = f.data[j+p];
659  }
660  }
661 
662  template<class C>
663  void maxs( monomials<C> & mm, monomials<C> & f, int v )
664  {
665 
666  int p,k,i,j;
667  int * sszs = f.szs() ;
668  int * sstr = f.str() ;
669 
670  for ( p = 0, k = 0; k < sszs[v]; k++, p += sstr[v] )
671  {
672  mm.data[k] = f.data[p];
673  for ( i = 0; i < f.size(); i += sstr[v-1] )
674  for ( j = i; j < i + sstr[v]; j ++ )
675  if ( f.data[j+p] > mm[k] ) mm[k] = f.data[j+p];
676  }
677  }
678 
679  //rename variable v to n
680  template<class C>
681  void rename_var(monomials<C> & f, const int & v, const int & n )
682  {
683  int * vr = f.vrs();
684 
685  for (int i=0; i< f.nvr(); ++i)
686  if (vr[i]==v) {
687  vr[i]=n;
688  break; }
689  }
690 
691 };//namespace tensor
692 } //namespace mmx
693 #endif /* realroot_MPOLDSE_MONOMIAL_C */
int * str()
Definition: tensor_monomials.hpp:77
void print_flatten(SYNTAX &out, const monomials< C > &mpl, const variables &Var=monom< C >::var)
Definition: tensor_monomials_fcts.hpp:332
void ipsub(A *a, unsigned *aadd, unsigned nadd, const B *b)
Definition: tensor_vctops.hpp:170
void hevalm(R &result, const C *data, const eenv &env, const P &p)
Definition: tensor_eenv_loops.hpp:45
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
void scdiv(A *a, const B &b, unsigned n, int s=1)
Definition: tensor_vctops.hpp:116
T pow(const T &a, int i)
Definition: binomials.hpp:12
void fill(C *a, unsigned n, int s, const C &x)
Definition: tensor_vctops.hpp:152
const C & b
Definition: Interval_glue.hpp:25
void waddm(monomials< X > &mpla, const monomials< Y > &mplb)
Definition: tensor_monomials_fcts.hpp:175
TMPL X
Definition: polynomial_operators.hpp:148
void add(bernstein< C > &mpl, const C &c)
Definition: tensor_bernstein_fcts.hpp:53
void swap(monomials< C > &a)
Definition: tensor_monomials.hpp:88
int * szs()
Definition: tensor_eenv_fcts.hpp:12
void subs0(Result *result, const bernstein< Coeff > &controls, const Parameters &parameters)
Definition: tensor_bernstein_fcts.hpp:216
static bool equal(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:74
void clear(monomials< C > &monoms)
Definition: tensor_monomials_fcts.hpp:87
MP swap(const MP &P, int var_i, int var_j)
Definition: sparse_monomials.hpp:988
bool with_plus_sign(const ZZ &c)
Definition: GMP.hpp:62
void mul(bernstein< C > &r, const bernstein< C > &a, const bernstein< C > &b)
Definition: tensor_bernstein_fcts.hpp:142
int leading_variable(const monomials< Coeff > &p)
Definition: tensor_monomials_fcts.hpp:367
void ipadd(A *a, unsigned *aadd, unsigned nadd, const B *b)
Definition: tensor_vctops.hpp:164
static bool subset(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:344
int size() const
Definition: tensor_monomials.hpp:72
static eenv common(const eenv &a, const eenv &b)
Definition: tensor_eenv_fcts.hpp:211
int * vrs()
Definition: tensor_eenv_fcts.hpp:18
void slice(C *dst, const eenv &a, const C *src, int v, int n)
Definition: tensor_eenv_loops.hpp:525
Definition: tensor_eenv.hpp:9
int localv(int i) const
Definition: tensor_eenv.hpp:61
int degree(const bernstein< C > &p)
Definition: tensor_bernstein.hpp:73
int * vrs()
Definition: tensor_monomials.hpp:76
eenv face_env(const eenv &e, int lv)
Definition: tensor_monomials_fcts.hpp:428
void eval(Result &result, const bernstein< Coeff > &controls, const Parameters &parameters)
Definition: tensor_bernstein_fcts.hpp:195
void mdiff(C *dst, const eenv &a, C const *const src, const eenv &esrc, int v)
Definition: tensor_eenv_loops.hpp:348
void sub(bernstein< C > &r, const bernstein< C > &a)
Definition: tensor_bernstein_fcts.hpp:105
vector_type data
Definition: tensor_monomials.hpp:32
tensor::eenv eenv
Definition: tensor_convert.hpp:12
void contraction(monomials< C > &f, const C &t, const int &v)
Compute f (a*var[v])
Definition: tensor_monomials_fcts.hpp:613
C * begin()
Definition: tensor_monomials.hpp:47
int nvr() const
number of variables
Definition: tensor_eenv_fcts.hpp:9
int nbvar() const
Definition: tensor_monomials.hpp:73
C * end()
Definition: tensor_monomials.hpp:48
std::vector< C > vector_type
Definition: tensor_monomials.hpp:21
void icopy(A *a, unsigned *aadd, unsigned nadd, const B *b)
Definition: tensor_vctops.hpp:158
const C entry(std::vector< int > deg)
Definition: tensor_monomials_fcts.hpp:479
Dynamic exponent.
Definition: dynamicexp.hpp:25
UPOL convert(const MPOL &p, unsigned v)
Definition: tensor_convert.hpp:73
void rename_var(monomials< C > &f, const int &v, const int &n)
Definition: tensor_monomials_fcts.hpp:681
Definition: tensor_monomials.hpp:18
TMPL void face(Polynomial &r, const Polynomial &p, int v, int f)
Definition: polynomial_fcts.hpp:188
TMPL syntactic flatten(const MONOMIAL &v)
Definition: monomial_glue.hpp:36
void print(OSTREAM &o, const bernstein< C > &mpl)
Definition: tensor_bernstein_fcts.hpp:298
static eenv diff(const eenv &b, int lv)
Definition: tensor_eenv_fcts.hpp:270
void set_variable(monomials< C > &f, C t, int v)
Compute f (x_v=t)
Definition: tensor_monomials_fcts.hpp:534
void heval(Result &result, const monomials< Coeff > &monoms, const Parameters &parameters)
Definition: tensor_monomials_fcts.hpp:148
int sz() const
return the total number of coefficients of the dense representation
Definition: tensor_eenv_fcts.hpp:16
void maxs(OutputIterator _maxs_, const C *data, const eenv &env, int v)
Definition: tensor_eenv_loops.hpp:106
void wsubm(monomials< X > &mpla, const monomials< Y > &mplb)
Definition: tensor_monomials_fcts.hpp:238
void levalm(R &result, const C *data, const eenv &env, const P &p)
Definition: tensor_eenv_loops.hpp:20
int nvr() const
Definition: tensor_monomials.hpp:74
TMPL Polynomial diff(const Polynomial &p, int v)
Definition: tensor_bernstein.hpp:79
int esz() const
Definition: tensor_monomials.hpp:71
void mpolfill(C *data, const sparse::monomial_seq< X, O > &mpol, const eenv &env)
Definition: tensor_eenv_loops.hpp:541
void shift(monomials< C > &f, const C &t, const int &v)
Compute f (var[v]+t)
Definition: tensor_monomials_fcts.hpp:497
int * szs()
Definition: tensor_monomials.hpp:75
const C & c
Definition: Interval_glue.hpp:45
void reciprocal(monomials< C > &f, const int &v)
Compute f (1/var[v])
Definition: tensor_monomials_fcts.hpp:577
void islice(monomials< C > &f, const monomials< C > &src, int v, int i)
Definition: tensor_monomials_fcts.hpp:464
double C
Definition: solver_mv_fatarcs.cpp:16
int Var(const T &v)
Definition: sign_variation.hpp:161
void lface(bernstein< C > &f, const bernstein< C > &src, int v)
Definition: tensor_bernstein_fcts.hpp:354
Monomial class.
Definition: monomial.hpp:62
void extend(monomials< C > &mpl, const eenv &nenv)
Definition: tensor_monomials_fcts.hpp:160
bool varindex(int &lv, const monomials< C > &mpl, int gv)
Definition: tensor_monomials_fcts.hpp:99
void horner(O &o, C const *const c, unsigned n, const I &i, int s=1)
Definition: tensor_vctops.hpp:420
void div(bernstein< C > &r, const bernstein< C > &a, const C &c)
Definition: tensor_bernstein_fcts.hpp:178
Interval< T, r > max(const Interval< T, r > &a, const Interval< T, r > &b)
Definition: Interval_fcts.hpp:135
bool hasvar(int &lv, int gv) const
Definition: tensor_eenv_fcts.hpp:131
Definition: array.hpp:12
void conv(MPLBASE0 &r, const MPLBASE1 &a)
Definition: tensor_convert.hpp:62
void rface(bernstein< C > &f, const bernstein< C > &src, int v)
Definition: tensor_bernstein_fcts.hpp:361
Definition: variables.hpp:65
void realloc(monomials< C > &mpl, const eenv &nenv)
Definition: tensor_monomials_fcts.hpp:77
int mxvr() const
Definition: tensor_eenv.hpp:67
eenv env
Definition: tensor_monomials.hpp:31
void scmul(A *a, const B &b, unsigned n, int s=1)
Definition: tensor_vctops.hpp:98
void mins(OutputIterator _mins_, const C *data, const eenv &env, int v)
Definition: tensor_eenv_loops.hpp:123
OS & print(OS &os, const R &v)
Output function for general vectors: [v1, v2, ...].
Definition: array.hpp:39
#define assert(expr, msg)
Definition: shared_object.hpp:57
Home