evalue_substitute: properly handle relations
[barvinok.git] / piptest.c
blob01425fc14fdd3956519487a89c1cdc147eec4828
1 #include "piputil.h"
2 #include <barvinok/evalue.h>
3 #include <barvinok/barvinok.h>
5 #define MAXRAYS 0
7 int main(int argc, char **argv)
9 Polyhedron *A;
10 Matrix *M;
11 Polyhedron *D, *P, *N;
12 char **param_name;
13 int exist, nparam, nvar;
14 char s[128];
15 evalue sum;
17 M = Matrix_Read();
18 A = Constraints2Polyhedron(M, MAXRAYS);
19 Matrix_Free(M);
21 fgets(s, 128, stdin);
22 while ((*s=='#') || (sscanf(s, "E %d", &exist)<1))
23 fgets(s, 128, stdin);
25 fgets(s, 128, stdin);
26 while ((*s=='#') || (sscanf(s, "P %d", &nparam)<1))
27 fgets(s, 128, stdin);
29 Polyhedron_Print(stdout, P_VALUE_FMT, A);
30 printf("exist: %d, nparam: %d\n", exist, nparam);
31 param_name = Read_ParamNames(stdin, nparam);
33 nvar = A->Dimension - exist - nparam;
34 D = pip_projectout(A, nvar, exist, nparam);
36 value_init(sum.d);
37 evalue_set_si(&sum, 0, 1);
38 for (P = D; P; P = N) {
39 evalue *EP;
40 N = P->next;
41 P->next = 0;
42 exist = P->Dimension - nvar - nparam;
43 EP = barvinok_enumerate_e(P, exist, nparam, MAXRAYS);
44 print_evalue(stderr, EP, (const char **)param_name);
45 eadd(EP, &sum);
47 print_evalue(stderr, &sum, (const char **)param_name);