From b9335c9d5bb5aca150d928b594db1b6a8ecdb418 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 17 Oct 2007 16:09:47 +0200 Subject: [PATCH] gen_fun::summate: handle full specialization --- genfun.cc | 11 +++++++++++ testlib.cc | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/genfun.cc b/genfun.cc index 309bd89..5285336 100644 --- a/genfun.cc +++ b/genfun.cc @@ -868,6 +868,17 @@ gen_fun *gen_fun::summate(int nvar, barvinok_options *options) const reducer *red; gen_fun *gf; + if (nparam == 0) { + bool finite; + Value c; + value_init(c); + finite = summate(&c); + assert(finite); + gf = new gen_fun(c); + value_clear(c); + return gf; + } + if (options->incremental_specialization == 1) { red = new partial_ireducer(Polyhedron_Project(context, nparam), dim, nparam); } else diff --git a/testlib.cc b/testlib.cc index 2418d42..bf3067a 100644 --- a/testlib.cc +++ b/testlib.cc @@ -286,6 +286,20 @@ static int test_series(struct barvinok_options *options) Polyhedron_Free(C); delete gf; + M = matrix_read_from_str( + "2 3\n" + "1 1 0\n" + "1 -1 10\n"); + P = Constraints2Polyhedron(M, options->MaxRays); + Matrix_Free(M); + C = Universe_Polyhedron(1); + gf = barvinok_series_with_options(P, C, options); + Polyhedron_Free(P); + Polyhedron_Free(C); + gen_fun *sum = gf->summate(1, options); + delete gf; + delete sum; + return 0; } -- 2.11.4.GIT