rename cdd2polylib.pl to latte2polylib.pl
[barvinok.git] / piptest.c
blob54e53cdeecf8f88d40fe5519cbbdd008a16ed33e
1 #include <polylib/polylibgmp.h>
2 #include "piputil.h"
3 #include <barvinok/evalue.h>
4 #include <barvinok/barvinok.h>
5 #include "config.h"
7 #ifdef HAVE_GROWING_CHERNIKOVA
8 #define MAXRAYS 0
9 #else
10 #define MAXRAYS 600
11 #endif
13 int main(int argc, char **argv)
15 Polyhedron *A;
16 Matrix *M;
17 Polyhedron *D, *P, *N;
18 char **param_name;
19 int exist, nparam, nvar;
20 char s[128];
21 evalue sum;
23 M = Matrix_Read();
24 A = Constraints2Polyhedron(M, MAXRAYS);
25 Matrix_Free(M);
27 fgets(s, 128, stdin);
28 while ((*s=='#') || (sscanf(s, "E %d", &exist)<1))
29 fgets(s, 128, stdin);
31 fgets(s, 128, stdin);
32 while ((*s=='#') || (sscanf(s, "P %d", &nparam)<1))
33 fgets(s, 128, stdin);
35 Polyhedron_Print(stdout, P_VALUE_FMT, A);
36 printf("exist: %d, nparam: %d\n", exist, nparam);
37 param_name = Read_ParamNames(stdin, nparam);
39 nvar = A->Dimension - exist - nparam;
40 D = pip_projectout(A, nvar, exist, nparam);
42 value_init(sum.d);
43 evalue_set_si(&sum, 0, 1);
44 for (P = D; P; P = N) {
45 evalue *EP;
46 N = P->next;
47 P->next = 0;
48 exist = P->Dimension - nvar - nparam;
49 EP = barvinok_enumerate_e(P, exist, nparam, MAXRAYS);
50 print_evalue(stderr, EP, param_name);
51 eadd(EP, &sum);
53 print_evalue(stderr, &sum, param_name);