From 90a0fd6eea0378a6012e7faf64213cd7d4834459 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 1 Apr 2007 16:47:02 +0200 Subject: [PATCH] barvinok_enumerate: optionally compute "volume" polynomial approximation --- barvinok.cc | 4 ++++ barvinok/options.h | 1 + options.c | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/barvinok.cc b/barvinok.cc index de86c54..02157a7 100644 --- a/barvinok.cc +++ b/barvinok.cc @@ -24,6 +24,7 @@ extern "C" { #include "genfun_constructor.h" #include "remove_equalities.h" #include "scale.h" +#include "volume.h" #ifdef NTL_STD_CXX using namespace NTL; @@ -1809,6 +1810,9 @@ static evalue* barvinok_enumerate_ev_f(Polyhedron *P, Polyhedron* C, unsigned nparam = C->Dimension; bool do_scale = options->approximation_method == BV_APPROX_SCALE; + if (options->approximation_method == BV_APPROX_VOLUME) + return Param_Polyhedron_Volume(P, C, options); + if (P->Dimension - nparam == 1 && !do_scale) return ParamLine_Length(P, C, options); diff --git a/barvinok/options.h b/barvinok/options.h index f6ef555..34d0a87 100644 --- a/barvinok/options.h +++ b/barvinok/options.h @@ -47,6 +47,7 @@ struct barvinok_options { #define BV_APPROX_NONE 0 #define BV_APPROX_DROP 1 #define BV_APPROX_SCALE 2 + #define BV_APPROX_VOLUME 3 int approximation_method; #define BV_APPROX_SCALE_FAST (1 << 0) #define BV_APPROX_SCALE_NARROW (1 << 1) diff --git a/options.c b/options.c index 4098864..692432e 100644 --- a/options.c +++ b/options.c @@ -114,7 +114,7 @@ struct argp_option barvinok_argp_options[] = { { "table", BV_OPT_TABLE, 0, 0 }, { "specialization", BV_OPT_SPECIALIZATION, "[bf|df|random]", 0 }, { "polynomial-approximation", BV_OPT_POLAPPROX, "lower|upper", 1 }, - { "approximation-method", BV_OPT_APPROX, "scale|drop", 0, + { "approximation-method", BV_OPT_APPROX, "scale|drop|volume", 0, "method to use in polynomial approximation [default: drop]" }, { "scale-options", BV_OPT_SCALE, "fast|slow,narrow|narrow2", 0 }, { "gbr", BV_OPT_GBR, "[cdd]", 0, @@ -172,6 +172,8 @@ error_t barvinok_parse_opt(int key, char *arg, struct argp_state *state) options->approximation_method = BV_APPROX_SCALE; else if (!strcmp(arg, "drop")) options->approximation_method = BV_APPROX_DROP; + else if (!strcmp(arg, "volume")) + options->approximation_method = BV_APPROX_VOLUME; else argp_error(state, "unknown value for --approximation-method option"); break; -- 2.11.4.GIT