3 #include <barvinok/evalue.h>
4 #include <barvinok/util.h>
5 #include <barvinok/barvinok.h>
8 /* The input of this example program is the same as that of testehrhart
9 * in the PolyLib distribution, i.e., a polytope in combined
10 * data and parameter space, a context polytope in parameter space
11 * and (optionally) the names of the parameters.
12 * Both polytopes are in PolyLib notation.
16 #define getopt_long(a,b,c,d,e) getopt(a,b,c)
19 struct option options
[] = {
20 { "convert", no_argument
, 0, 'c' },
21 { "floor", no_argument
, 0, 'f' },
22 { "size", no_argument
, 0, 's' },
23 { "version", no_argument
, 0, 'V' },
28 int main(int argc
, char **argv
)
38 struct barvinok_options
*bv_options
= barvinok_options_new_with_defaults();
40 while ((c
= getopt_long(argc
, argv
, "fcsV", options
, &ind
)) != -1) {
52 printf(barvinok_version());
59 A
= Constraints2Polyhedron(M
, bv_options
->MaxRays
);
62 C
= Constraints2Polyhedron(M
, bv_options
->MaxRays
);
64 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
65 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
66 param_name
= Read_ParamNames(stdin
, C
->Dimension
);
67 EP
= barvinok_enumerate_with_options(A
, C
, bv_options
);
68 print_evalue(stdout
, EP
, param_name
);
70 printf("\nSize: %d\n", evalue_size(EP
));
72 fprintf(stderr
, "WARNING: floor conversion not supported\n");
73 evalue_frac2floor2(EP
, 0);
74 print_evalue(stdout
, EP
, param_name
);
76 evalue_mod2table(EP
, C
->Dimension
);
77 print_evalue(stdout
, EP
, param_name
);
79 printf("\nSize: %d\n", evalue_size(EP
));
83 Free_ParamNames(param_name
, C
->Dimension
);