1 #include <barvinok/options.h>
4 #include "param_util.h"
6 /* This program computes the full-dimensional chambers of the vector
11 * The input is the matrix A in PolyLib notation.
12 * The output consists of the number of chambers, followed by
13 * a constraint description of each chamber in PolyLib notation.
23 * $ ./vector_partition_chambers < elke
42 static Polyhedron
*partition2polyhedron(Matrix
*A
,
43 struct barvinok_options
*options
)
46 unsigned nvar
, nparam
;
53 M
= Matrix_Alloc(nvar
+ nparam
, 1 + nvar
+ nparam
+ 1);
56 for (i
= 0; i
< nparam
; ++i
) {
57 Vector_Copy(A
->p
[i
], M
->p
[i
] + 1, nvar
);
58 value_set_si(M
->p
[i
][1 + nvar
+ i
], -1);
60 for (i
= 0; i
< nvar
; ++i
) {
61 value_set_si(M
->p
[nparam
+ i
][0], 1);
62 value_set_si(M
->p
[nparam
+ i
][1 + i
], 1);
65 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
71 int main(int argc
, char **argv
)
79 struct barvinok_options
*options
= barvinok_options_new_with_defaults();
81 set_program_name(argv
[0]);
82 argp_parse(&barvinok_argp
, argc
, argv
, 0, 0, options
);
88 C
= Universe_Polyhedron(nparam
);
89 P
= partition2polyhedron(A
, options
);
92 PP
= Polyhedron2Param_Polyhedron(P
, C
, options
);
97 for (PD
= PP
->D
; PD
; PD
= PD
->next
)
100 printf("%d\n", nchamber
);
101 for (PD
= PP
->D
; PD
; PD
= PD
->next
) {
103 Polyhedron_PrintConstraints(stdout
, P_VALUE_FMT
, PD
->Domain
);
105 Param_Polyhedron_Free(PP
);
107 barvinok_options_free(options
);