check whether projection is bounded
[barvinok.git] / barvinok_count.c
blob5c7c9975703f077a16175e8a77712a9bc6c5149d
1 #include <unistd.h>
2 #include <sys/times.h>
3 #include <polylib/polylibgmp.h>
4 #include <util.h>
5 #include <barvinok.h>
7 static void time_diff(struct tms *before, struct tms *after)
9 long ticks = sysconf(_SC_CLK_TCK);
10 printf("User: %g; Sys: %g\n",
11 (0.0 + after->tms_utime - before->tms_utime) / ticks,
12 (0.0 + after->tms_stime - before->tms_stime) / ticks);
15 int main()
17 Value cm, cb;
18 struct tms tms_before, tms_between, tms_after;
19 Polyhedron *A;
20 Matrix *M;
22 M = Matrix_Read();
23 A = Constraints2Polyhedron(M, 600);
24 Matrix_Free(M);
25 value_init(cm);
26 value_init(cb);
27 Polyhedron_Print(stdout, P_VALUE_FMT, A);
28 times(&tms_before);
29 manual_count(A, &cm);
30 times(&tms_between);
31 barvinok_count(A, &cb, 100);
32 times(&tms_after);
33 printf("manual: ");
34 value_print(stdout, P_VALUE_FMT, cm);
35 puts("");
36 time_diff(&tms_before, &tms_between);
37 printf("Barvinok: ");
38 value_print(stdout, P_VALUE_FMT, cb);
39 puts("");
40 time_diff(&tms_between, &tms_after);
41 value_clear(cm);
42 value_clear(cb);
43 Polyhedron_Free(A);
44 return 0;