1 /*************************************************/
3 /* program to count the number of points */
4 /* in a parameterized polytope */
9 /* written by Vincent Loechner, aug. 2000. */
10 /* loechner@icps.u-strasbg.fr */
11 /*************************************************/
17 #include <polylib/polylib64.h>
20 /****************************************************************/
21 int main(int argc
,char *argv
[]) {
24 Polyhedron
*C
, *P
, *S
;
32 /******* Read the input *********/
35 if(C1
->NbColumns
< 2) {
36 fprintf(stderr
,"Not enough parameters !\n");
39 P
= Constraints2Polyhedron(P1
, MAXRAYS
);
40 C
= Constraints2Polyhedron(C1
, MAXRAYS
);
45 /******* Compute the true context *******/
46 CC
= align_context(C
,P
->Dimension
,MAXRAYS
);
47 PP
= DomainIntersection(P
,CC
,MAXRAYS
);
49 C1
= Matrix_Alloc(C
->Dimension
+1,P
->Dimension
+1);
50 for(i
=0;i
<C1
->NbRows
;i
++)
51 for(j
=0;j
<C1
->NbColumns
;j
++)
52 if(i
==j
-P
->Dimension
+C
->Dimension
)
53 value_set_si(C1
->p
[i
][j
],1);
55 value_set_si(C1
->p
[i
][j
],0);
56 CC
= Polyhedron_Image(PP
,C1
,MAXRAYS
);
62 /******* Initialize parameters *********/
63 p
= (Value
*)malloc(sizeof(Value
) * (P
->Dimension
+2));
64 for(i
=0;i
<=P
->Dimension
;i
++) {
71 /*** S = scanning list of polyhedra ***/
72 S
= Polyhedron_Scan(P
,C
,MAXRAYS
);
74 /******* Count now *********/
77 printf("Enter %d parameters : ",C
->Dimension
);
78 for(k
=S
->Dimension
-C
->Dimension
+1;k
<=S
->Dimension
;++k
) {
83 value_print(stdout
,VALUE_FMT
,p
[S
->Dimension
-C
->Dimension
+1]);
84 for(k
=S
->Dimension
-C
->Dimension
+2;k
<=S
->Dimension
;++k
) {
86 value_print(stdout
,VALUE_FMT
,p
[k
]);
88 printf(" ) = %d\n",count_points(1,S
,p
));
90 for(i
=0;i
<=(P
->Dimension
+1);i
++)