gen_fun::Hadamard_product: don't assume equalities are independent
[barvinok.git] / dpoly.h
blob21d4bd27a0cc5a3bed45a5648eb9f2bb456d4b14
1 #ifndef DPOLY_H
2 #define DPOLY_H
4 #include <assert.h>
5 #include <vector>
6 #include <gmp.h>
7 #include <NTL/vec_ZZ.h>
8 extern "C" {
9 #include <polylib/polylibgmp.h>
11 #include "conversion.h"
13 #ifdef NTL_STD_CXX
14 using namespace NTL;
15 #endif
17 class dpoly {
18 public:
19 vec_ZZ coeff;
20 dpoly(int d, ZZ& degree, int offset = 0);
21 void operator *= (dpoly& f);
22 void div(dpoly& d, mpq_t count, ZZ& sign);
23 void div(dpoly& d, mpq_t *count, const mpq_t& factor);
24 private:
25 mpq_t *div(dpoly &d) const;
26 void clear_div(mpq_t *c) const;
29 struct dpoly_r_term {
30 int *powers;
31 ZZ coeff;
34 /* len: number of elements in c
35 * each element in c is the coefficient of a power of t
36 * in the MacLaurin expansion
38 struct dpoly_r {
39 std::vector< dpoly_r_term * > *c;
40 int len;
41 int dim;
42 ZZ denom;
44 void add_term(int i, int * powers, ZZ& coeff);
45 dpoly_r(int len, int dim);
46 dpoly_r(dpoly& num, int dim);
47 dpoly_r(dpoly& num, dpoly& den, int pos, int dim);
48 dpoly_r(dpoly_r* num, dpoly& den, int pos, int dim);
49 ~dpoly_r();
50 dpoly_r *div(dpoly& d);
51 void dump(void);
54 #endif