volume.c: drop redundant arguments to volume_simplex
[barvinok.git] / dpoly.h
blob9a636ee69266ec79d46fd7fb0b9061d7dea290dd
1 #ifndef DPOLY_H
2 #define DPOLY_H
4 #include <assert.h>
5 #include <set>
6 #include <vector>
7 #include <gmp.h>
8 #include <NTL/vec_ZZ.h>
9 #include <barvinok/polylib.h>
10 #include "conversion.h"
12 #ifdef NTL_STD_CXX
13 using namespace NTL;
14 #endif
16 class dpoly {
17 public:
18 vec_ZZ coeff;
19 dpoly(int d, ZZ& degree, int offset = 0);
20 void operator += (const dpoly& t);
21 void operator *= (const ZZ& f);
22 void operator *= (dpoly& f);
23 void div(dpoly& d, mpq_t count, ZZ& sign);
24 void div(dpoly& d, mpq_t *count, const mpq_t& factor);
25 private:
26 mpq_t *div(dpoly &d) const;
27 void clear_div(mpq_t *c) const;
30 /* Each element in powers corresponds to a factor of the form (1 - z^b)
31 * and indicates the exponent of this factor in the denominator.
32 * The constants b are stored elsewhere (den_r in reducer::reducer).
34 struct dpoly_r_term {
35 std::vector<int> powers;
36 ZZ coeff;
39 struct dpoly_r_term_lex_smaller {
40 bool operator()(const dpoly_r_term* t1, const dpoly_r_term* t2) const {
41 return t1->powers < t2->powers;
45 typedef std::set<dpoly_r_term*, dpoly_r_term_lex_smaller> dpoly_r_term_list;
47 /* len: number of elements in c
48 * each element in c is the coefficient of a power of t
49 * in the MacLaurin expansion
51 struct dpoly_r {
52 dpoly_r_term_list *c;
53 int len;
54 int dim;
55 ZZ denom;
57 void add_term(int i, const std::vector<int>& powers, const ZZ& coeff);
58 dpoly_r(int len, int dim);
59 dpoly_r(dpoly& num, int dim);
60 dpoly_r(dpoly& num, dpoly& den, int pos, int dim);
61 dpoly_r(const dpoly_r* num, dpoly& den, int pos, int dim);
62 ~dpoly_r();
63 dpoly_r *div(const dpoly& d) const;
64 void dump(void);
67 #endif