barvinok.cc: drop redundant include
[barvinok.git] / genfun_constructor.h
blobac3cf9fb039fb7638e96549cf630fcb7b34a75d4
1 #include <gmp.h>
2 #include <NTL/vec_ZZ.h>
3 #include <NTL/mat_ZZ.h>
4 #include <barvinok/NTL_QQ.h>
5 #include <barvinok/polylib.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 using namespace NTL;
14 /* base for generating function counting */
15 struct gf_base {
16 np_base *base;
17 gen_fun *gf;
19 gf_base(np_base *npb, Polyhedron *context) : base(npb) {
20 gf = new gen_fun(context);
22 virtual ~gf_base() {
24 static gf_base *create(Polyhedron *context, unsigned dim, unsigned nparam,
25 barvinok_options *options);
27 void start_gf(Polyhedron *P, barvinok_options *options) {
28 base->start(P, options);
32 struct partial_ireducer : public ireducer, public gf_base {
33 partial_ireducer(Polyhedron *context, unsigned dim, unsigned nparam) :
34 ireducer(dim), gf_base(this, context) {
35 lower = nparam;
37 ~partial_ireducer() {
39 virtual void base(const QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
40 virtual gen_fun *get_gf() {
41 return gf;
45 struct partial_reducer : public reducer, public gf_base {
46 vec_ZZ lambda;
47 vec_ZZ tmp;
49 partial_reducer(Polyhedron *context, unsigned dim, unsigned nparam) :
50 reducer(dim), gf_base(this, context) {
51 lower = nparam;
53 tmp.SetLength(dim - nparam);
55 virtual void init(Polyhedron *P, int n_try) {
56 randomvector(P, lambda, dim - lower, n_try);
58 virtual void reset() {
59 gf->clear_terms();
61 ~partial_reducer() {
63 virtual void base(const QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
64 virtual void base(const vec_QQ& c, const mat_ZZ& num, const mat_ZZ& den_f);
66 virtual void split(const mat_ZZ& num, vec_ZZ& num_s, mat_ZZ& num_p,
67 const mat_ZZ& den_f, vec_ZZ& den_s, mat_ZZ& den_r);
68 virtual gen_fun *get_gf() {
69 return gf;
73 struct partial_bfcounter : public bfcounter_base, public gf_base {
74 partial_bfcounter(Polyhedron *context, unsigned dim, unsigned nparam) :
75 bfcounter_base(dim), gf_base(this, context) {
76 lower = nparam;
78 ~partial_bfcounter() {
80 virtual void base(mat_ZZ& factors, bfc_vec& v);