5 #include <polylib/polylib.h>
8 int main( int argc
, char **argv
)
11 const char **param_name
;
16 Matrix
* Validity_Lattice
;
26 nb_parms
= C1
->NbColumns
-2;
28 fprintf( stderr
, "Not enough parameters !\n" );
32 /* Read the name of the parameters */
33 param_name
= Read_ParamNames(stdin
,nb_parms
);
35 /* inflate the polyhedron, so that the inflated EP approximation will be an
36 upper bound for the EP's polyhedron. */
37 mpolyhedron_deflate(P1
,nb_parms
);
39 /* compute a polynomial approximation of the Ehrhart polynomial */
40 e
= Ehrhart_Quick_Apx(P1
, C1
, &Validity_Lattice
, 1024);
45 printf("============ Ehrhart polynomial quick polynomial lower bound ============\n");
46 show_matrix(Validity_Lattice
);
47 for( en
=e
; en
; en
=en
->next
) {
48 Print_Domain(stdout
,en
->ValidityDomain
, param_name
);
49 print_evalue(stdout
,&en
->EP
, param_name
);
50 printf( "\n-----------------------------------\n" );
54 if( isatty(0) && nb_parms
!= 0)
55 { /* no tty input or no polyhedron -> no evaluation. */
56 printf("Evaluation of the Ehrhart polynomial :\n");
57 p
= (Value
*)malloc(sizeof(Value
) * (nb_parms
));
58 for(i
=0;i
<nb_parms
;i
++)
62 printf("Enter %d parameters : ",nb_parms
);
63 for(k
=0;k
<nb_parms
;++k
) {
67 fprintf(stdout
,"EP( ");
68 value_print(stdout
,VALUE_FMT
,p
[0]);
69 for(k
=1;k
<nb_parms
;++k
) {
71 value_print(stdout
,VALUE_FMT
,p
[k
]);
73 fprintf(stdout
," ) = ");
74 value_print(stdout
,VALUE_FMT
,*(tmp
=compute_poly(en
,p
)));
79 #endif /* EP_EVALUATION */
83 free_evalue_refs( &(e
->EP
) );
84 Polyhedron_Free( e
->ValidityDomain
);
89 Free_ParamNames(param_name
, nb_parms
);