barvinok_enumerate: make sure the input polyhedra are fully specified.
[barvinok.git] / genfun.h
blobeb29481aab82c211069c0b37f66c7c4c5cce037d
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 "ev_operations.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 mat_ZZ coeff;
20 mat_ZZ power;
21 } n;
22 struct __short_rat_d {
23 /* rows: factors in denominator */
24 mat_ZZ power;
25 } d;
28 struct gen_fun {
29 std::vector< short_rat * > term;
30 Polyhedron *context;
32 void add(const ZZ& cn, const ZZ& cd, const vec_ZZ& num,
33 const mat_ZZ& den);
34 void print(unsigned int nparam, char **param_name) const;
35 operator evalue *() const;
36 void coefficient(Value* params, Value* c) const;
38 gen_fun(Polyhedron *C = NULL) : context(C) {}
39 ~gen_fun() {
40 if (context)
41 Polyhedron_Free(context);
42 for (int i = 0; i < term.size(); ++i)
43 delete term[i];
47 #endif