summaryrefslogtreecommitdiff
path: root/isl_tab_pip.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2011-04-19 15:45:05 +0200
committerSven Verdoolaege <skimo@kotnet.org>2011-04-21 13:13:12 +0200
commit91d2fb654332f179e1e11346fdfe5670198dae59 (patch)
treeabab4e00f474cba4bfb13ec493b459c48049f493 /isl_tab_pip.c
parentd0abc03e77a69bf16bae6f00eabc7f859d1780b8 (diff)
downloadisl-91d2fb654332f179e1e11346fdfe5670198dae59.tar.gz
isl-91d2fb654332f179e1e11346fdfe5670198dae59.tar.bz2
isl-91d2fb654332f179e1e11346fdfe5670198dae59.zip
add isl_tab_basic_set_non_neg_lexmin
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_tab_pip.c')
-rw-r--r--isl_tab_pip.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/isl_tab_pip.c b/isl_tab_pip.c
index 0e49e21c..94b868d2 100644
--- a/isl_tab_pip.c
+++ b/isl_tab_pip.c
@@ -4955,3 +4955,30 @@ error:
isl_vec_free(sol);
return NULL;
}
+
+/* Return the lexicographically smallest rational point in "bset",
+ * assuming that all variables are non-negative.
+ * If "bset" is empty, then return a zero-length vector.
+ */
+ __isl_give isl_vec *isl_tab_basic_set_non_neg_lexmin(
+ __isl_take isl_basic_set *bset)
+{
+ struct isl_tab *tab;
+ isl_ctx *ctx = isl_basic_set_get_ctx(bset);
+ isl_vec *sol;
+
+ tab = tab_for_lexmin(isl_basic_map_from_range(bset), NULL, 0, 0);
+ if (!tab)
+ goto error;
+ if (tab->empty)
+ sol = isl_vec_alloc(ctx, 0);
+ else
+ sol = isl_tab_get_sample_value(tab);
+ isl_tab_free(tab);
+ isl_basic_set_free(bset);
+ return sol;
+error:
+ isl_tab_free(tab);
+ isl_basic_set_free(bset);
+ return NULL;
+}