privately export isl_tab_kill_col
[platform/upstream/isl.git] / isl_map_piplib.c
index e7bbf0d..55089e8 100644 (file)
@@ -1,5 +1,6 @@
 #include "isl_set.h"
 #include "isl_map.h"
+#include "isl_mat.h"
 #include "isl_seq.h"
 #include "isl_piplib.h"
 #include "isl_map_piplib.h"
@@ -387,7 +388,14 @@ PipMatrix *isl_basic_map_to_pip(struct isl_basic_map *bmap, unsigned pip_param,
        return M;
 }
 
-static struct isl_map *extremum_on(
+PipMatrix *isl_basic_set_to_pip(struct isl_basic_set *bset, unsigned pip_param,
+                        unsigned extra_front, unsigned extra_back)
+{
+       return isl_basic_map_to_pip((struct isl_basic_map *)bset,
+                                       pip_param, extra_front, extra_back);
+}
+
+struct isl_map *isl_pip_basic_map_lexopt(
                struct isl_basic_map *bmap, struct isl_basic_set *dom,
                struct isl_set **empty, int max)
 {
@@ -398,6 +406,7 @@ static struct isl_map *extremum_on(
        PipMatrix *domain = NULL, *context = NULL;
        unsigned         nparam, n_in, n_out;
 
+       bmap = isl_basic_map_detect_equalities(bmap);
        if (!bmap || !dom)
                goto error;
 
@@ -455,77 +464,3 @@ error:
        isl_basic_set_free(dom);
        return NULL;
 }
-
-struct isl_map *isl_pip_basic_map_lexmax(
-               struct isl_basic_map *bmap, struct isl_basic_set *dom,
-               struct isl_set **empty)
-{
-       return extremum_on(bmap, dom, empty, 1);
-}
-
-struct isl_map *isl_pip_basic_map_lexmin(
-               struct isl_basic_map *bmap, struct isl_basic_set *dom,
-               struct isl_set **empty)
-{
-       return extremum_on(bmap, dom, empty, 0);
-}
-
-struct isl_map *isl_pip_basic_map_compute_divs(struct isl_basic_map *bmap)
-{
-       PipMatrix *domain = NULL, *context = NULL;
-       PipOptions      *options;
-       PipQuast        *sol;
-       struct isl_ctx  *ctx;
-       struct isl_dim  *dim;
-       struct isl_map  *map;
-       struct isl_set  *set;
-       struct isl_basic_set    *dom;
-       unsigned         nparam;
-       unsigned         n_in;
-       unsigned         n_out;
-
-       if (!bmap)
-               goto error;
-
-       ctx = bmap->ctx;
-       nparam = isl_basic_map_n_param(bmap);
-       n_in = isl_basic_map_n_in(bmap);
-       n_out = isl_basic_map_n_out(bmap);
-
-       domain = isl_basic_map_to_pip(bmap, nparam + n_in + n_out, 0, 0);
-       if (!domain)
-               goto error;
-       context = pip_matrix_alloc(0, nparam + n_in + n_out + 2);
-       if (!context)
-               goto error;
-
-       options = pip_options_init();
-       options->Simplify = 1;
-       options->Urs_unknowns = -1;
-       options->Urs_parms = -1;
-       sol = pip_solve(domain, context, -1, options);
-
-       dom = isl_basic_set_alloc(ctx, nparam, n_in + n_out, 0, 0, 0);
-       map = isl_map_from_quast(ctx, sol,
-               isl_dim_reverse(isl_dim_copy(dom->dim)), dom, NULL);
-
-       pip_quast_free(sol);
-       pip_options_free(options);
-       pip_matrix_free(domain);
-       pip_matrix_free(context);
-
-       dim = isl_dim_copy(bmap->dim);
-       isl_basic_map_free(bmap);
-
-       set = isl_map_domain(map);
-
-       return isl_map_from_set(set, dim);
-error:
-       if (domain)
-               pip_matrix_free(domain);
-       if (context)
-               pip_matrix_free(context);
-       isl_basic_set_free(dom);
-       isl_basic_map_free(bmap);
-       return NULL;
-}