1 #include <barvinok/options.h>
2 #include "param_util.h"
4 /* This program computes the full-dimensional chambers of the vector
9 * The input is the matrix A in PolyLib notation.
10 * The output consists of the number of chambers, followed by
11 * a constraint description of each chamber in PolyLib notation.
21 * $ ./vector_partition_chambers < elke
40 static Polyhedron
*partition2polyhedron(Matrix
*A
,
41 struct barvinok_options
*options
)
44 unsigned nvar
, nparam
;
51 M
= Matrix_Alloc(nvar
+ nparam
, 1 + nvar
+ nparam
+ 1);
54 for (i
= 0; i
< nparam
; ++i
) {
55 Vector_Copy(A
->p
[i
], M
->p
[i
] + 1, nvar
);
56 value_set_si(M
->p
[i
][1 + nvar
+ i
], -1);
58 for (i
= 0; i
< nvar
; ++i
) {
59 value_set_si(M
->p
[nparam
+ i
][0], 1);
60 value_set_si(M
->p
[nparam
+ i
][1 + i
], 1);
63 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
69 int main(int argc
, char **argv
)
77 struct barvinok_options
*options
= barvinok_options_new_with_defaults();
79 argc
= barvinok_options_parse(options
, argc
, argv
, ISL_ARG_ALL
);
85 C
= Universe_Polyhedron(nparam
);
86 P
= partition2polyhedron(A
, options
);
89 PP
= Polyhedron2Param_Polyhedron(P
, C
, options
);
94 for (PD
= PP
->D
; PD
; PD
= PD
->next
)
97 printf("%d\n", nchamber
);
98 for (PD
= PP
->D
; PD
; PD
= PD
->next
) {
100 Polyhedron_PrintConstraints(stdout
, P_VALUE_FMT
, PD
->Domain
);
102 Param_Polyhedron_Free(PP
);
104 barvinok_options_free(options
);