collect terms with the same denominator
[barvinok.git] / count_domain.c
blobe9887e7471966fee2a2b57bc26da54b84c9c6edd
1 #include <assert.h>
2 #include <dlfcn.h>
3 #include "ev_operations.h"
4 #include "barvinok.h"
6 /* gcc -shared count_domain.c -rdynamic -o libcount.so -ldl -lc */
8 evalue* barvinok_enumerate_ev(Polyhedron *P, Polyhedron* C, unsigned MaxRays)
10 static evalue *(*orig)(Polyhedron *, Polyhedron *c, unsigned) = NULL;
11 evalue *res;
12 int c;
14 if (!orig) {
15 void *handle = dlopen("libbarvinok.so", RTLD_LAZY);
16 assert(handle);
17 orig = dlsym(handle, "barvinok_enumerate_ev");
18 assert(orig);
19 dlclose(handle);
22 res = orig(P, C, MaxRays);
24 c = value_notzero_p(res->d) ? 0
25 : res->x.p->type == partition ? res->x.p->size/2 : 1;
26 fprintf(stderr, "COUNT: %d %d %d %d\n", P->Dimension,
27 C->Dimension, c, domain_size(P));
29 return res;