also skip over zeroes and remember original location for constant-test
[barvinok.git] / barvinok_enumerate.c
blob2568ef58aca3ce447cd24e235f4bcf18ebcea847
1 #include <unistd.h>
2 #include <sys/times.h>
3 #include <getopt.h>
4 #include <polylib/polylibgmp.h>
5 #include "ev_operations.h"
6 #include <util.h>
7 #include <barvinok.h>
9 struct option options[] = {
10 { "convert", no_argument, 0, 'c' },
11 { 0, 0, 0, 0 }
15 int main(int argc, char **argv)
17 Polyhedron *A, *C;
18 Matrix *M;
19 Enumeration *en;
20 char **param_name;
21 int c, ind = 0;
22 int convert = 0;
24 while ((c = getopt_long(argc, argv, "c", options, &ind)) != -1) {
25 switch (c) {
26 case 'c':
27 convert = 1;
28 break;
32 M = Matrix_Read();
33 A = Constraints2Polyhedron(M, 600);
34 Matrix_Free(M);
35 M = Matrix_Read();
36 C = Constraints2Polyhedron(M, 600);
37 Matrix_Free(M);
38 Polyhedron_Print(stdout, P_VALUE_FMT, A);
39 Polyhedron_Print(stdout, P_VALUE_FMT, C);
40 param_name = Read_ParamNames(stdin, C->Dimension);
41 en = barvinok_enumerate(A, C, 600);
42 Enumeration_Print(stdout, en, param_name);
43 if (convert) {
44 Enumeration_mod2table(en, C->Dimension);
45 Enumeration_Print(stdout, en, param_name);
47 Enumeration_Free(en);
48 Free_ParamNames(param_name, C->Dimension);
49 Polyhedron_Free(A);
50 Polyhedron_Free(C);
51 return 0;