Dense multivariate polynomials

The dense multivariate polynomials

template<class C, 
         class R = mpoldse::monomial<C> > 
struct MPolDse<C,R>;

are parameterised by

Containers for multivariate polynomials

The representation R for this class could be mpoldse::monomial or mpoldse::bernstein.

See also:
mpol/mpoldse/monomial.h, mpol/mpoldse/bernstein.h

Example

o+

#include <synaps/arithm/gmp.h>
#include <synaps/mpol/MPolDse.h>

typedef double  coeff_t;
typedef MPolDse<coeff_t, mpoldse::monomial<coeff_t> > Monomial;

//| p0 = x1 + x2 + 1, p1 = x1^2 + x2 + 1
  
int main (int argc, char **argv)
{
  using std::cout; using std::endl;
  Monomial a("x1+x2+1"), b("x2+x1^2+1");
  cout << "Monomial a(\"x1+x2+1\"), b(\"x2+x1^2+1\");\n";
  cout << " a = " <<  a << endl;
  cout << " b = " <<  b << endl;
  Monomial c(a+b); 
  cout << "Monomial c(a+b);\n";
  cout << " c = " << c << endl;
  cout << "c += a-b;\n";
  c += a-b; 
  cout << " c = " << c << endl;
  //| x1^2 + x1 + 2*x2 + 2
  cout << "c += a-b;\n";
  cout << " c = " << c << endl;
  c=a-b*coeff_t(2);
  cout <<  "c=a-b*coeff_t(2);\n";
  cout << " c = " << c << endl;
  
  cout << "Monomial  dm;\n";
  Monomial dm;
  diff( dm,  b, 0 /* first variable in lex order */);
  cout << "diff( dm,  b, 0 /* first variable in lex order */);\n";
  cout << " dm = " << dm << endl;
  //| - 2*x1^2 + x1 - x2 - 1
  return 0;

}

Implementation


SYNAPS DOCUMENTATION
logo