iscc: test isl_stream for eof rather than the underlying FILE
[barvinok.git] / verify_series.cc
blob8a0c06731d870908409b61da387bc03d64c4ad18
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 int k;
16 Value c, tmp, one;
17 struct check_poly_gf_data* gf_data = (struct check_poly_gf_data*) data;
18 const skewed_gen_fun *gf = gf_data->gf;
19 int exist = gf_data->exist;
20 Polyhedron *S = gf_data->S;
22 value_init(c);
23 value_init(tmp);
24 value_init(one);
25 value_set_si(one, 1);
27 /* Computes the coefficient */
28 gf->coefficient(z, &c, options->barvinok);
30 /* Manually count the number of points */
31 count_points_e(1, S, exist, nparam, data->z, &tmp);
33 check_poly_print(value_eq(tmp, c), nparam, z, tmp, one, c, one,
34 "EP", "count", "EP eval", options);
36 value_clear(c);
37 value_clear(tmp);
38 value_clear(one);
39 return 1;
42 int check_poly_gf(Polyhedron *S, Polyhedron *CS, skewed_gen_fun *gf,
43 int exist, int nparam, int pos, Value *z,
44 const struct verify_options *options)
46 struct check_poly_gf_data data;
47 data.cp.z = z;
48 data.cp.check = cp_gf;
49 data.S = S;
50 data.gf = gf;
51 data.exist = exist;
52 return check_poly(CS, &data.cp, nparam, pos, z+S->Dimension-nparam+1,
53 options);