replace { E/m } by { (E-1)/m } + 1/m if { E/m } != 0
[barvinok.git] / barvinok_enumerate.c
blob2860b4c6416d6a426753d84eacf35f01b05ef536
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 { "size", no_argument, 0, 's' },
12 { 0, 0, 0, 0 }
16 int main(int argc, char **argv)
18 Polyhedron *A, *C;
19 Matrix *M;
20 Enumeration *en;
21 char **param_name;
22 int c, ind = 0;
23 int convert = 0;
24 int size = 0;
26 while ((c = getopt_long(argc, argv, "cs", options, &ind)) != -1) {
27 switch (c) {
28 case 'c':
29 convert = 1;
30 break;
31 case 's':
32 size = 1;
33 break;
37 M = Matrix_Read();
38 A = Constraints2Polyhedron(M, 600);
39 Matrix_Free(M);
40 M = Matrix_Read();
41 C = Constraints2Polyhedron(M, 600);
42 Matrix_Free(M);
43 Polyhedron_Print(stdout, P_VALUE_FMT, A);
44 Polyhedron_Print(stdout, P_VALUE_FMT, C);
45 param_name = Read_ParamNames(stdin, C->Dimension);
46 en = barvinok_enumerate(A, C, 600);
47 Enumeration_Print(stdout, en, param_name);
48 if (size)
49 printf("\nSize: %d\n", Enumeration_size(en));
50 if (convert) {
51 Enumeration_mod2table(en, C->Dimension);
52 Enumeration_Print(stdout, en, param_name);
53 if (size)
54 printf("\nSize: %d\n", Enumeration_size(en));
56 Enumeration_Free(en);
57 Free_ParamNames(param_name, C->Dimension);
58 Polyhedron_Free(A);
59 Polyhedron_Free(C);
60 return 0;