4 #include <polylib/polylibgmp.h>
8 static void time_diff(struct tms
*before
, struct tms
*after
)
10 long ticks
= sysconf(_SC_CLK_TCK
);
11 printf("User: %g; Sys: %g\n",
12 (0.0 + after
->tms_utime
- before
->tms_utime
) / ticks
,
13 (0.0 + after
->tms_stime
- before
->tms_stime
) / ticks
);
18 static const int size
= 1000;
19 static const int loop
= 10;
24 struct tms tms_before
, tms_between
, tms_after
;
28 for (d
= 2; d
< 10; ++d
) {
29 M
= Matrix_Alloc(2*d
, 2+d
);
30 for (r
= 0; r
< 2*d
; ++r
)
31 value_set_si(M
->p
[r
][0], 1);
32 for (i
= 0; i
< loop
; ++i
) {
33 for (r
= 0; r
< 2*d
; ++r
) {
34 for (c
= 1; c
< 1+d
; ++c
) {
35 value_set_si(M
->p
[r
][c
], random_int(size
));
37 value_set_si(M
->p
[r
][d
+1], random_int(2)+1);
39 P
= Rays2Polyhedron(M
, 2*d
);
40 Polyhedron_Print(stdout
, P_VALUE_FMT
, P
);
44 barvinok_count(P
, &cb
, 100);
47 value_print(stdout
, P_VALUE_FMT
, cm
);
49 time_diff(&tms_before
, &tms_between
);
51 value_print(stdout
, P_VALUE_FMT
, cb
);
53 time_diff(&tms_between
, &tms_after
);
54 assert(value_eq(cm
, cb
));