reducer::reduce: better handling of terms with common denominators
[barvinok.git] / piptest.c
blobb3e6c8b5758e80289e161296ce34b6ee2c77b7b7
1 #include "piputil.h"
2 #include <barvinok/evalue.h>
3 #include <barvinok/barvinok.h>
4 #include "config.h"
6 #ifdef HAVE_GROWING_CHERNIKOVA
7 #define MAXRAYS 0
8 #else
9 #define MAXRAYS 600
10 #endif
12 int main(int argc, char **argv)
14 Polyhedron *A;
15 Matrix *M;
16 Polyhedron *D, *P, *N;
17 char **param_name;
18 int exist, nparam, nvar;
19 char s[128];
20 evalue sum;
22 M = Matrix_Read();
23 A = Constraints2Polyhedron(M, MAXRAYS);
24 Matrix_Free(M);
26 fgets(s, 128, stdin);
27 while ((*s=='#') || (sscanf(s, "E %d", &exist)<1))
28 fgets(s, 128, stdin);
30 fgets(s, 128, stdin);
31 while ((*s=='#') || (sscanf(s, "P %d", &nparam)<1))
32 fgets(s, 128, stdin);
34 Polyhedron_Print(stdout, P_VALUE_FMT, A);
35 printf("exist: %d, nparam: %d\n", exist, nparam);
36 param_name = Read_ParamNames(stdin, nparam);
38 nvar = A->Dimension - exist - nparam;
39 D = pip_projectout(A, nvar, exist, nparam);
41 value_init(sum.d);
42 evalue_set_si(&sum, 0, 1);
43 for (P = D; P; P = N) {
44 evalue *EP;
45 N = P->next;
46 P->next = 0;
47 exist = P->Dimension - nvar - nparam;
48 EP = barvinok_enumerate_e(P, exist, nparam, MAXRAYS);
49 print_evalue(stderr, EP, param_name);
50 eadd(EP, &sum);
52 print_evalue(stderr, &sum, param_name);