doc: document extra occ operations
[barvinok.git] / genfun_constructor.h
blob2109b2fd5cf9efb8cf6ab585b69a2bdb5fbd7094
1 #include <gmp.h>
2 #include <NTL/mat_ZZ.h>
3 extern "C" {
4 #include <polylib/polylibgmp.h>
6 #include <barvinok/util.h>
7 #include <barvinok/genfun.h>
8 #include <barvinok/options.h>
9 #include "reducer.h"
10 #include "bfcounter.h"
12 #ifdef NTL_STD_CXX
13 using namespace NTL;
14 #endif
16 /* base for generating function counting */
17 struct gf_base {
18 np_base *base;
19 gen_fun *gf;
21 gf_base(np_base *npb, Polyhedron *context) : base(npb) {
22 gf = new gen_fun(context);
24 virtual ~gf_base() {
26 static gf_base *create(Polyhedron *context, unsigned dim, unsigned nparam,
27 barvinok_options *options);
29 void start_gf(Polyhedron *P, barvinok_options *options) {
30 base->start(P, options);
34 struct partial_ireducer : public ireducer, public gf_base {
35 partial_ireducer(Polyhedron *context, unsigned dim, unsigned nparam) :
36 ireducer(dim), gf_base(this, context) {
37 lower = nparam;
39 ~partial_ireducer() {
41 virtual void base(QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
42 virtual gen_fun *get_gf() {
43 return gf;
47 struct partial_reducer : public reducer, public gf_base {
48 vec_ZZ lambda;
49 vec_ZZ tmp;
51 partial_reducer(Polyhedron *context, unsigned dim, unsigned nparam) :
52 reducer(dim), gf_base(this, context) {
53 lower = nparam;
55 tmp.SetLength(dim - nparam);
57 virtual void init(Polyhedron *P) {
58 randomvector(P, lambda, dim - lower);
60 ~partial_reducer() {
62 virtual void base(QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
64 virtual void split(vec_ZZ& num, ZZ& num_s, vec_ZZ& num_p,
65 mat_ZZ& den_f, vec_ZZ& den_s, mat_ZZ& den_r);
66 virtual gen_fun *get_gf() {
67 return gf;
71 struct partial_bfcounter : public bfcounter_base, public gf_base {
72 partial_bfcounter(Polyhedron *context, unsigned dim, unsigned nparam) :
73 bfcounter_base(dim), gf_base(this, context) {
74 lower = nparam;
76 ~partial_bfcounter() {
78 virtual void base(mat_ZZ& factors, bfc_vec& v);