1 #include <barvinok/util.h>
2 #include "skewed_genfun.h"
3 #include "verify_series.h"
4 
5 struct check_poly_gf_data {
6     struct check_poly_data   cp;
7     Polyhedron		    *S;
8     const skewed_gen_fun    *gf;
9     int	    	    	     exist;
10 };
11 
cp_gf(const struct check_poly_data * data,int nparam,Value * z,const struct verify_options * options)12 static int cp_gf(const struct check_poly_data *data, int nparam, Value *z,
13 		 const struct verify_options *options)
14 {
15     Value c, tmp, one;
16     struct check_poly_gf_data* gf_data = (struct check_poly_gf_data*) data;
17     const skewed_gen_fun *gf = gf_data->gf;
18     int exist = gf_data->exist;
19     Polyhedron *S = gf_data->S;
20 
21     value_init(c);
22     value_init(tmp);
23     value_init(one);
24     value_set_si(one, 1);
25 
26     /* Computes the coefficient */
27     gf->coefficient(z, &c, options->barvinok);
28 
29     /* Manually count the number of points */
30     count_points_e(1, S, exist, nparam, data->z, &tmp);
31 
32     check_poly_print(value_eq(tmp, c), nparam, z, tmp, one, c, one,
33 		     "EP", "count", "EP eval", options);
34 
35     value_clear(c);
36     value_clear(tmp);
37     value_clear(one);
38     return 1;
39 }
40 
check_poly_gf(Polyhedron * S,Polyhedron * CS,skewed_gen_fun * gf,int exist,int nparam,int pos,Value * z,const struct verify_options * options)41 int check_poly_gf(Polyhedron *S, Polyhedron *CS, skewed_gen_fun *gf,
42 		    int exist, int nparam, int pos, Value *z,
43 		    const struct verify_options *options)
44 {
45     struct check_poly_gf_data data;
46     data.cp.z = z;
47     data.cp.check = cp_gf;
48     data.S = S;
49     data.gf = gf;
50     data.exist = exist;
51     return check_poly(CS, &data.cp, nparam, pos, z+S->Dimension-nparam+1,
52 			options);
53 }
54