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>
10 #include "bfcounter.h"
14 /* base for generating function counting */
19 gf_base(np_base
*npb
, Polyhedron
*context
) : base(npb
) {
20 gf
= new gen_fun(context
);
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
) {
39 virtual void base(const QQ
& c
, const vec_ZZ
& num
, const mat_ZZ
& den_f
);
40 virtual gen_fun
*get_gf() {
45 struct partial_reducer
: public reducer
, public gf_base
{
49 partial_reducer(Polyhedron
*context
, unsigned dim
, unsigned nparam
) :
50 reducer(dim
), gf_base(this, context
) {
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() {
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() {
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
) {
78 ~partial_bfcounter() {
80 virtual void base(mat_ZZ
& factors
, bfc_vec
& v
);