2 This file is part of PolyLib.
4 PolyLib is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 PolyLib is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with PolyLib. If not, see <http://www.gnu.org/licenses/>.
18 /*************************************************/
20 /* program to count the number of points */
21 /* in a parameterized polytope */
23 /* input : polytope */
26 /* written by Vincent Loechner, aug. 2000. */
27 /* loechner@icps.u-strasbg.fr */
28 /*************************************************/
34 #include <polylib/polylib.h>
37 /****************************************************************/
38 int main(int argc
,char *argv
[]) {
41 Polyhedron
*C
, *P
, *S
;
50 /******* Read the input *********/
53 if(C1
->NbColumns
< 2) {
54 fprintf(stderr
,"Not enough parameters !\n");
57 P
= Constraints2Polyhedron(P1
, MAXRAYS
);
58 C
= Constraints2Polyhedron(C1
, MAXRAYS
);
63 /******* Compute the true context *******/
64 CC
= align_context(C
,P
->Dimension
,MAXRAYS
);
65 PP
= DomainIntersection(P
,CC
,MAXRAYS
);
67 C1
= Matrix_Alloc(C
->Dimension
+1,P
->Dimension
+1);
68 for(i
=0;i
<C1
->NbRows
;i
++)
69 for(j
=0;j
<C1
->NbColumns
;j
++)
70 if(i
==j
-P
->Dimension
+C
->Dimension
)
71 value_set_si(C1
->p
[i
][j
],1);
73 value_set_si(C1
->p
[i
][j
],0);
74 CC
= Polyhedron_Image(PP
,C1
,MAXRAYS
);
80 /******* Initialize parameters *********/
81 p
= (Value
*)malloc(sizeof(Value
) * (P
->Dimension
+2));
82 for(i
=0;i
<=P
->Dimension
;i
++) {
89 /*** S = scanning list of polyhedra ***/
90 S
= Polyhedron_Scan(P
,C
,MAXRAYS
);
94 /******* Count now *********/
97 printf("Enter %d parameters : ",C
->Dimension
);
98 for(k
=S
->Dimension
-C
->Dimension
+1;k
<=S
->Dimension
;++k
) {
100 value_read(p
[k
],str
);
103 value_print(stdout
,VALUE_FMT
,p
[S
->Dimension
-C
->Dimension
+1]);
104 for(k
=S
->Dimension
-C
->Dimension
+2;k
<=S
->Dimension
;++k
) {
106 value_print(stdout
,VALUE_FMT
,p
[k
]);
109 count_points(1,S
,p
,&c
);
110 value_print(stdout
,VALUE_FMT
,c
);
113 for(i
=0;i
<=(P
->Dimension
+1);i
++)