specify subdir-objects option for forward compatibility with automake 2.0
[barvinok.git] / genfun_constructor.h
blob18f7c250b8f5b420759e478926e6cd32f5b7034a
1 #include <gmp.h>
2 #include <NTL/mat_ZZ.h>
3 #include <barvinok/util.h>
4 #include <barvinok/genfun.h>
5 #include <barvinok/options.h>
6 #include "reducer.h"
7 #include "bfcounter.h"
9 using namespace NTL;
11 /* base for generating function counting */
12 struct gf_base {
13 np_base *base;
14 gen_fun *gf;
16 gf_base(np_base *npb, Polyhedron *context) : base(npb) {
17 gf = new gen_fun(context);
19 virtual ~gf_base() {
21 static gf_base *create(Polyhedron *context, unsigned dim, unsigned nparam,
22 barvinok_options *options);
24 void start_gf(Polyhedron *P, barvinok_options *options) {
25 base->start(P, options);
29 struct partial_ireducer : public ireducer, public gf_base {
30 partial_ireducer(Polyhedron *context, unsigned dim, unsigned nparam) :
31 ireducer(dim), gf_base(this, context) {
32 lower = nparam;
34 ~partial_ireducer() {
36 virtual void base(const QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
37 virtual gen_fun *get_gf() {
38 return gf;
42 struct partial_reducer : public reducer, public gf_base {
43 vec_ZZ lambda;
44 vec_ZZ tmp;
46 partial_reducer(Polyhedron *context, unsigned dim, unsigned nparam) :
47 reducer(dim), gf_base(this, context) {
48 lower = nparam;
50 tmp.SetLength(dim - nparam);
52 virtual void init(Polyhedron *P, int n_try) {
53 randomvector(P, lambda, dim - lower, n_try);
55 virtual void reset() {
56 gf->clear_terms();
58 ~partial_reducer() {
60 virtual void base(const QQ& c, const vec_ZZ& num, const mat_ZZ& den_f);
61 virtual void base(const vec_QQ& c, const mat_ZZ& num, const mat_ZZ& den_f);
63 virtual void split(const mat_ZZ& num, vec_ZZ& num_s, mat_ZZ& num_p,
64 const mat_ZZ& den_f, vec_ZZ& den_s, mat_ZZ& den_r);
65 virtual gen_fun *get_gf() {
66 return gf;
70 struct partial_bfcounter : public bfcounter_base, public gf_base {
71 partial_bfcounter(Polyhedron *context, unsigned dim, unsigned nparam) :
72 bfcounter_base(dim), gf_base(this, context) {
73 lower = nparam;
75 ~partial_bfcounter() {
77 virtual void base(mat_ZZ& factors, bfc_vec& v);