isl_union_set_apply_union_pw_qpolynomial: rename "dim" variable to "space"
[barvinok.git] / verify_series.cc
blobcd3aeb63ca8bed1a350f7ed0d295908d2b97cd33
1 #include <barvinok/util.h>
2 #include "skewed_genfun.h"
3 #include "verify_series.h"
5 struct check_poly_gf_data {
6 struct check_poly_data cp;
7 Polyhedron *S;
8 const skewed_gen_fun *gf;
9 int exist;
12 static int cp_gf(const struct check_poly_data *data, int nparam, Value *z,
13 const struct verify_options *options)
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;
21 value_init(c);
22 value_init(tmp);
23 value_init(one);
24 value_set_si(one, 1);
26 /* Computes the coefficient */
27 gf->coefficient(z, &c, options->barvinok);
29 /* Manually count the number of points */
30 count_points_e(1, S, exist, nparam, data->z, &tmp);
32 check_poly_print(value_eq(tmp, c), nparam, z, tmp, one, c, one,
33 "EP", "count", "EP eval", options);
35 value_clear(c);
36 value_clear(tmp);
37 value_clear(one);
38 return 1;
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)
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);