Developer documentation

polynomial_dual_glue.hpp
Go to the documentation of this file.
1 #ifndef realroot_sparse_dual_glue_hpp
2 #define realroot_sparse_dual_glue_hpp
3 #include <basix/mmx_syntax.hpp>
5 #define TMPL template <class C>
6 #define RING ring<C, Dual,DegRevLex>
7 #define RING_POL ring<C, Sparse,DegRevLex>
8 #define Polynomial polynomial<C, with<Dual,DegRevLex> >
9 //======================================================================
10 namespace mmx {
11  TMPL unsigned hash(const RING& p){ return 1;}
12  TMPL unsigned exact_hash(const RING& p){ return 1;}
13  TMPL unsigned soft_hash(const RING& p){ return 1;}
14  TMPL bool exact_eq (const RING& p, const RING& q){ return true;}
15  TMPL bool exact_neq(const RING& p, const RING& q){ return false;}
16 
17  TMPL bool operator ==(const RING& p, const RING& q){ return true;}
18  TMPL bool operator !=(const RING& p, const RING& q){ return false;}
19 
20  TMPL syntactic flatten(const RING& Rg) {
21  syntactic CF= flatten(scalar_set<C>());
22  vector<syntactic> rg; rg <<CF;
23  vector<syntactic> Lv;
24  for(int i=0;i<Rg.nbvar();i++)
25  Lv<<syntactic(string("d")<<RING_POL::var[i].data());
26  rg << apply(GEN_SQTUPLE,Lv);
27  return apply (GEN_ACCESS, rg);
28  }
29 
30  TMPL RING dual_of(const RING_POL& rg) {
31  return RING();
32  }
33 
34  TMPL RING dual_of(const RING_POL& rg, const generic& x) {
35  return RING();
36  }
37 
38  TMPL syntactic flatten(const Polynomial& p) {
39  typedef typename Polynomial::const_iterator iterator;
40  syntactic r(0);
41  for(iterator it=p.begin(); it!=p.end();it++)
42  {
43  syntactic m= flatten(it->coeff());
44  for(unsigned i=0;i<it->nbvar();i++)
45  {
46  syntactic v = string("d")<<RING_POL::var[i].data();
47  m = m*pow(v,syntactic(-(*it)[i]));
48  }
49  r+=m;
50  }
51  return r;
52  }
53 
55  polynomial_dual(const RING& rg, const C& c) {
56  return Polynomial(c);
57  }
58 
60  polynomial_dual(const RING& rg, const C& c, int d, int v) {
61  return Polynomial(c,v,d);
62  }
63 
65  polynomial_dual(const RING& rg, const string& s) {
66  return Polynomial(as_charp(s));
67  }
69  polynomial_dual(const RING& r, const generic& s) {
70  return Polynomial(as_charp(as_mmx(s)));
71  }
72 
73  TMPL vector<generic>
74  polynomial_dual_coefficients(const Polynomial& f, const int & v) {
76  vector<generic> r;
77  for(unsigned i=0; i< l.size(); i++)
78  r<< as<generic>(l[i]);
79  return r;
80  }
81 
82  TMPL vector<generic>
84  typedef typename Polynomial::const_iterator const_iterator;
85  vector<generic> r;
86  for(const_iterator it=p.begin(); it!=p.end();it++)
87  r<< as<generic>(it->coeff());
88  return r;
89  }
90 } //namespace mmx
91 //======================================================================
92 #undef TMPL
93 #undef RING
94 #undef RING_POL
95 #undef Polynomial
96 #endif //realroot_sparse_dual_glue_hpp
bool operator==(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:88
Sequence of terms with reference counter.
Definition: Seq.hpp:28
T pow(const T &a, int i)
Definition: binomials.hpp:12
TMPL RING dual_of(const RING_POL &rg)
Definition: polynomial_dual_glue.hpp:30
TMPL bool exact_neq(const Monomial &v1, const Monomial &v2)
Definition: monomial_glue.hpp:24
TMPL unsigned exact_hash(const Monomial &m)
Definition: monomial_glue.hpp:32
TMPL unsigned hash(const Monomial &v)
Definition: monomial_glue.hpp:26
#define RING
Definition: polynomial_dual_glue.hpp:6
TMPL Polynomial polynomial_dual(const RING &rg, const C &c)
Definition: polynomial_dual_glue.hpp:55
polynomial< COEFF, with< MonomialTensor > > Polynomial
Definition: solver_mv_cf.cpp:23
size_type size() const
Definition: Seq.hpp:166
TMPL syntactic flatten(const MONOMIAL &v)
Definition: monomial_glue.hpp:36
char * as_charp(const scalar< MPZ > &b)
Definition: scalar_integer.hpp:444
TMPL bool exact_eq(const Monomial &v1, const Monomial &v2)
Definition: monomial_glue.hpp:23
#define RING_POL
Definition: polynomial_dual_glue.hpp:7
const C & c
Definition: Interval_glue.hpp:45
TMPL vector< generic > polynomial_dual_coefficients(const Polynomial &f, const int &v)
Definition: polynomial_dual_glue.hpp:74
double C
Definition: solver_mv_fatarcs.cpp:16
#define Polynomial
Definition: polynomial_dual_glue.hpp:8
bool operator!=(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:95
#define TMPL
Definition: polynomial_dual_glue.hpp:5
TMPL unsigned soft_hash(const Monomial &m)
Definition: monomial_glue.hpp:33
Definition: array.hpp:12
TMPL Seq< typename ring< C, Bernstein >::Polynomial > coefficients(const typename ring< C, Bernstein >::Polynomial &pol, int v)
Definition: polynomial_bernstein.hpp:74
Home