3 #include <polylib/polylibgmp.h>
4 #include <barvinok/evalue.h>
5 #include <barvinok/util.h>
6 #include <barvinok/barvinok.h>
9 /* The input of this example program is the same as that of testehrhart
10 * in the PolyLib distribution, i.e., a polytope in combined
11 * data and parameter space, a context polytope in parameter space
12 * and (optionally) the names of the parameters.
13 * Both polytopes are in PolyLib notation.
17 #define getopt_long(a,b,c,d,e) getopt(a,b,c)
20 struct option options
[] = {
21 { "convert", no_argument
, 0, 'c' },
22 { "floor", no_argument
, 0, 'f' },
23 { "size", no_argument
, 0, 's' },
24 { "version", no_argument
, 0, 'V' },
29 int main(int argc
, char **argv
)
39 struct barvinok_options
*bv_options
= barvinok_options_new_with_defaults();
41 while ((c
= getopt_long(argc
, argv
, "fcsV", options
, &ind
)) != -1) {
53 printf(barvinok_version());
60 A
= Constraints2Polyhedron(M
, bv_options
->MaxRays
);
63 C
= Constraints2Polyhedron(M
, bv_options
->MaxRays
);
65 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
66 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
67 param_name
= Read_ParamNames(stdin
, C
->Dimension
);
68 EP
= barvinok_enumerate_with_options(A
, C
, bv_options
);
69 print_evalue(stdout
, EP
, param_name
);
71 printf("\nSize: %d\n", evalue_size(EP
));
73 fprintf(stderr
, "WARNING: floor conversion not supported\n");
74 evalue_frac2floor(EP
);
75 print_evalue(stdout
, EP
, param_name
);
77 evalue_mod2table(EP
, C
->Dimension
);
78 print_evalue(stdout
, EP
, param_name
);
80 printf("\nSize: %d\n", evalue_size(EP
));
84 Free_ParamNames(param_name
, C
->Dimension
);