genfun.cc: move lex_cmp to mat_util.cc
[barvinok.git] / dpoly.h
blobb0b53f5033fa60f82201b51f5355450970c08c32
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 #include <barvinok/polylib.h>
9 #include "conversion.h"
11 #ifdef NTL_STD_CXX
12 using namespace NTL;
13 #endif
15 class dpoly {
16 public:
17 vec_ZZ coeff;
18 dpoly(int d, ZZ& degree, int offset = 0);
19 void operator *= (dpoly& f);
20 void div(dpoly& d, mpq_t count, ZZ& sign);
21 void div(dpoly& d, mpq_t *count, const mpq_t& factor);
22 private:
23 mpq_t *div(dpoly &d) const;
24 void clear_div(mpq_t *c) const;
27 struct dpoly_r_term {
28 int *powers;
29 ZZ coeff;
32 /* len: number of elements in c
33 * each element in c is the coefficient of a power of t
34 * in the MacLaurin expansion
36 struct dpoly_r {
37 std::vector< dpoly_r_term * > *c;
38 int len;
39 int dim;
40 ZZ denom;
42 void add_term(int i, int * powers, ZZ& coeff);
43 dpoly_r(int len, int dim);
44 dpoly_r(dpoly& num, int dim);
45 dpoly_r(dpoly& num, dpoly& den, int pos, int dim);
46 dpoly_r(dpoly_r* num, dpoly& den, int pos, int dim);
47 ~dpoly_r();
48 dpoly_r *div(dpoly& d);
49 void dump(void);
52 #endif