barvinok/genfun.h: a bit more documentation.
[barvinok.git] / barvinok / genfun.h
blob5ecfec488a2224b56967113dd1e78b711fc1d82e
1 #ifndef GENFUN_H
2 #define GENFUN_H
4 #include <vector>
5 #include <gmp.h>
6 #include <NTL/mat_ZZ.h>
7 extern "C" {
8 #include <polylib/polylibgmp.h>
9 #include <barvinok/evalue.h>
12 #ifdef NTL_STD_CXX
13 using namespace NTL;
14 #endif
16 struct short_rat {
17 struct __short_rat_n {
18 /* rows: terms in numerator */
19 /* coeff has two columns: the numerator and the denominator */
20 mat_ZZ coeff;
21 mat_ZZ power;
22 } n;
23 struct __short_rat_d {
24 /* rows: factors in denominator */
25 mat_ZZ power;
26 } d;
29 struct gen_fun {
30 std::vector< short_rat * > term;
31 Polyhedron *context;
33 void add(const ZZ& cn, const ZZ& cd, const vec_ZZ& num,
34 const mat_ZZ& den);
35 void print(unsigned int nparam, char **param_name) const;
36 operator evalue *() const;
37 void coefficient(Value* params, Value* c) const;
39 gen_fun(Polyhedron *C = NULL) : context(C) {}
40 ~gen_fun() {
41 if (context)
42 Polyhedron_Free(context);
43 for (int i = 0; i < term.size(); ++i)
44 delete term[i];
48 #endif