6 #include <polylib/polylibgmp.h>
11 #ifdef HAVE_GROWING_CHERNIKOVA
17 static void time_diff(struct tms
*before
, struct tms
*after
)
19 long ticks
= sysconf(_SC_CLK_TCK
);
20 printf("User: %g; Sys: %g\n",
21 (0.0 + after
->tms_utime
- before
->tms_utime
) / ticks
,
22 (0.0 + after
->tms_stime
- before
->tms_stime
) / ticks
);
27 int i
, nbPol
, nbVec
, func
, j
;
28 Polyhedron
*A
, *B
, *C
, *D
, *E
, *F
, *G
;
34 ((sscanf(s
, "D %d", &nbPol
)<1) && (sscanf(s
, "V %d", &nbVec
)<1)) )
37 for (i
= 0; i
< nbPol
; ++i
) {
38 Matrix
*M
= Matrix_Read();
39 A
= Constraints2Polyhedron(M
, MAXRAYS
);
42 while ((*s
=='#') || (sscanf(s
, "F %d", &func
)<1))
51 /* workaround for apparent bug in older gmps */
52 *strchr(s
, '\n') = '\0';
53 while ((*s
=='#') || (value_read(ck
, s
) != 0)) {
55 /* workaround for apparent bug in older gmps */
56 *strchr(s
, '\n') = '\0';
58 barvinok_count(A
, &cb
, 100);
66 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
67 B
= Polyhedron_Polar(A
, MAXRAYS
);
68 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
69 C
= Polyhedron_Polar(B
, MAXRAYS
);
70 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
75 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
76 for (j
= 0; j
< A
->NbRays
; ++j
) {
77 B
= supporting_cone(A
, j
);
78 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
83 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
85 barvinok_decompose(A
,&B
,&C
);
87 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
89 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
95 struct tms tms_before
, tms_between
, tms_after
;
98 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
100 manual_count(A
, &cm
);
102 barvinok_count(A
, &cb
, 100);
105 value_print(stdout
, P_VALUE_FMT
, cm
);
107 time_diff(&tms_before
, &tms_between
);
108 printf("Barvinok: ");
109 value_print(stdout
, P_VALUE_FMT
, cb
);
111 time_diff(&tms_between
, &tms_after
);
117 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
118 B
= triangularize_cone(A
, 100);
119 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
120 check_triangulization(A
, B
);
124 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
125 B
= remove_equalities(A
);
126 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
132 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
133 B
= Polyhedron_Reduce(A
, &f
);
134 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
137 value_print(stdout
, P_VALUE_FMT
, f
);
144 Matrix
*M
= Matrix_Read();
146 C
= Constraints2Polyhedron(M
, MAXRAYS
);
148 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
149 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
150 en
= barvinok_enumerate(A
, C
, MAXRAYS
);
151 param_name
= Read_ParamNames(stdin
, C
->Dimension
);
152 print_evalue(stdout
, &en
->EP
, param_name
);
153 Enumeration_Free(en
);
157 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
158 Polyhedron_Polarize(A
);
160 barvinok_decompose(A
,&B
,&C
);
161 for (D
= B
; D
; D
= D
->next
)
162 Polyhedron_Polarize(D
);
163 for (D
= C
; D
; D
= D
->next
)
164 Polyhedron_Polarize(D
);
166 Polyhedron_Print(stdout
, P_VALUE_FMT
, B
);
168 Polyhedron_Print(stdout
, P_VALUE_FMT
, C
);
175 for (i
= 0; i
< nbVec
; ++i
) {
176 Vector
*V
= Vector_Read();
177 Matrix
*M
= unimodular_complete(V
);
178 Matrix_Print(stdout
, P_VALUE_FMT
, M
);