remove functions for converting between isl and PolyLib
authorSven Verdoolaege <sven@cs.kuleuven.be>
Wed, 16 Dec 2009 14:17:19 +0000 (14:17 +0000)
committerSven Verdoolaege <sven@cs.kuleuven.be>
Wed, 16 Dec 2009 18:59:39 +0000 (18:59 +0000)
These functions could be seen as being derived work from PolyLib
and would therefore infect the whole library with the GPLv2 license.
They will be moved into a separate isl-polylib library.

Makefile.am
configure.ac
doc/user.pod
include/isl_config.h.in
include/isl_ctx.h
include/isl_map_polylib.h [deleted file]
include/isl_polylib.h [deleted file]
include/isl_set_polylib.h [deleted file]
isl_ctx.c
isl_map_polylib.c [deleted file]

index a92c2f5..332978d 100644 (file)
@@ -13,11 +13,6 @@ noinst_PROGRAMS = isl_test isl_polyhedron_sample isl_pip \
        isl_polyhedron_detect_equalities
 TESTS = isl_test
 
-if HAVE_POLYLIB
-ISL_POLYLIB = \
-       isl_map_polylib.c
-endif
-
 if HAVE_PIPLIB
 ISL_PIPLIB = \
        isl_lp_piplib.c \
@@ -41,7 +36,6 @@ endif
 
 libisl_la_SOURCES = \
        $(ISL_PIPLIB) \
-       $(ISL_POLYLIB) \
        $(GET_MEMORY_FUNCTIONS) \
        isl_affine_hull.c \
        isl_arg.c \
@@ -92,17 +86,15 @@ EXTRA_libisl_la_SOURCES = \
        isl_lp_no_piplib.c \
        isl_map_piplib.c \
        isl_map_no_piplib.c \
-       isl_map_polylib.c \
        isl_sample_no_piplib.c \
        isl_sample_piplib.c \
        isl_sample_piplib.h \
        isl_piplib.c
-libisl_la_LIBADD = $(PIPLIB_LA) @PIPLIB_LIBS@ @POLYLIB_LIBS@ -lgmp
+libisl_la_LIBADD = $(PIPLIB_LA) @PIPLIB_LIBS@ -lgmp
 libisl_la_LDFLAGS = -version-info @versioninfo@ \
-       @PIPLIB_LDFLAGS@ @POLYLIB_LDFLAGS@ @GMP_LDFLAGS@
+       @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@
 libisl_la_CPPFLAGS = -I$(srcdir)/include -Iinclude/ \
-       @PIPLIB_CPPFLAGS@ @POLYLIB_CPPFLAGS@ \
-       @GMP_CPPFLAGS@
+       @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@
 
 isl_test_CPPFLAGS = -I$(srcdir)/include -Iinclude/ @GMP_CPPFLAGS@
 isl_test_LDADD = libisl.la
@@ -154,12 +146,9 @@ pkginclude_HEADERS = \
        include/isl_lp.h \
        include/isl_mat.h \
        include/isl_map.h \
-       include/isl_map_polylib.h \
        include/isl_options.h \
-       include/isl_polylib.h \
        include/isl_seq.h \
        include/isl_set.h \
-       include/isl_set_polylib.h \
        include/isl_vec.h
 
 EXTRA_DIST = \
index 8f5afe5..4c5e747 100644 (file)
@@ -38,56 +38,6 @@ AC_CHECK_DECLS(mp_get_memory_functions,[],[
 CPPFLAGS="$SAVE_CPPFLAGS"
 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
 
-AX_SUBMODULE(polylib,no|system|build,no)
-
-have_polylib=false
-AC_SUBST(POLYLIB_CPPFLAGS)
-AC_SUBST(POLYLIB_LDFLAGS)
-AC_SUBST(POLYLIB_LIBS)
-case "$with_polylib" in
-       build)
-               polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
-               AC_MSG_NOTICE(Configured polylibs: $polylibs)
-               isl_cv_polylib=missing
-               for bits in $polylibs; do
-                       if test "$bits" = "libpolylibgmp.la"; then
-                               isl_cv_polylib=ok
-                       fi
-               done
-               if test "$isl_cv_polylib" = "missing"; then
-                       AC_MSG_ERROR(no gmp polylib configured)
-               fi
-               POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
-               POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
-       ;;
-       system)
-               POLYLIB_LIBS="-lpolylibgmp"
-               if test "x$with_polylib_prefix" != "x"; then
-                       POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
-                       POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
-               fi
-               SAVE_CPPFLAGS="$CPPFLAGS"
-               SAVE_LDFLAGS="$LDFLAGS"
-               CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
-               LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
-               AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[ true ],[
-                       AC_MSG_ERROR(Need polylib)
-               ])
-               CPPFLAGS="$SAVE_CPPFLAGS"
-               LDFLAGS="$SAVE_LDFLAGS"
-       ;;
-       no)
-       ;;
-       *)
-               AC_MSG_ERROR(unsupported)
-       ;;
-esac
-if test "$with_polylib" != "no"; then
-       AC_DEFINE(ISL_POLYLIB,,polylib is available)
-       have_polylib=true
-fi
-AM_CONDITIONAL(HAVE_POLYLIB, test x$have_polylib = xtrue)
-
 AX_SUBMODULE(piplib,no|system|build|bundled,no)
 
 have_piplib=false
index 116320c..8a887ab 100644 (file)
@@ -91,17 +91,15 @@ A complete list of options can be obtained by running
 
 Below we discuss some of the more common options.
 
-C<isl> can optionally use both C<PolyLib> and C<piplib>.
-C<PolyLib> is mainly used to convert between C<PolyLib> objects
-and C<isl> objects.  No C<piplib> functionality is currently
-used by default.
-The C<--with-polylib> and C<--with-piplib> options can
-be used to specify which C<PolyLib> or C<piplib>
+C<isl> can optionally use C<piplib>, but no
+C<piplib> functionality is currently used by default.
+The C<--with-piplib> option can
+be used to specify which C<piplib>
 library to use, either an installed version (C<system>),
 an externally built version (C<build>), a bundled version (C<bundled>)
 or no version (C<no>).  The option C<build> is mostly useful
 in C<configure> scripts of larger projects that bundle both C<isl>
-and either C<PolyLib> or C<piplib>.
+and C<piplib>.
 
 =over
 
@@ -117,22 +115,6 @@ Installation prefix for C<GMP> (architecture-independent files).
 
 Installation prefix for C<GMP> (architecture-dependent files).
 
-=item C<--with-polylib>
-
-Which copy of C<PolyLib> to use, either C<no> (default), C<system> or C<build>.
-
-=item C<--with-polylib-prefix>
-
-Installation prefix for C<system> C<PolyLib> (architecture-independent files).
-
-=item C<--with-polylib-exec-prefix>
-
-Installation prefix for C<system> C<PolyLib> (architecture-dependent files).
-
-=item C<--with-polylib-builddir>
-
-Location where C<build> C<PolyLib> was built.
-
 =item C<--with-piplib>
 
 Which copy of C<piplib> to use, either C<no> (default), C<system>, C<build>
@@ -389,8 +371,7 @@ C<isl_dim_out> (only for relations), C<isl_dim_set>
 
 Proper input and output functions are still in development.
 However, some functions are provided to read and write
-to foreign file formats and to convert between
-C<isl> objects and C<PolyLib> objects (if C<PolyLib> is available).
+to foreign file formats.
 
 =head3 Input
 
@@ -439,29 +420,6 @@ The coefficients of the existentially quantified variables
 appear between those of the set variables and those
 of the parameters.
 
-=head3 Conversion from/to C<PolyLib>
-
-The following functions are only available if C<isl> has
-been configured to use C<PolyLib>.
-
-       #include <isl_set_polylib.h>
-       __isl_give isl_basic_set *isl_basic_set_new_from_polylib(
-               Polyhedron *P, __isl_take isl_dim *dim);
-       Polyhedron *isl_basic_set_to_polylib(
-               __isl_keep isl_basic_set *bset);
-       __isl_give isl_set *isl_set_new_from_polylib(Polyhedron *D,
-               __isl_take isl_dim *dim);
-       Polyhedron *isl_set_to_polylib(__isl_keep isl_set *set);
-
-       #include <isl_map_polylib.h>
-       __isl_give isl_basic_map *isl_basic_map_new_from_polylib(
-               Polyhedron *P, __isl_take isl_dim *dim);
-       __isl_give isl_map *isl_map_new_from_polylib(Polyhedron *D,
-               __isl_take isl_dim *dim);
-       Polyhedron *isl_basic_map_to_polylib(
-               __isl_keep isl_basic_map *bmap);
-       Polyhedron *isl_map_to_polylib(__isl_keep isl_map *map);
-
 =head3 Dumping the internal state
 
 For lack of proper output functions, the following functions
@@ -941,3 +899,27 @@ is given, then the constant should appear in the last column.
 
 Given a polytope in C<PolyLib> format, C<isl_polytope_scan> prints
 all integer points in the polytope.
+
+=head1 C<isl-polylib>
+
+The C<isl-polylib> library provides the following functions for converting
+between C<isl> objects and C<PolyLib> objects.
+The library is distributed separately for licensing reasons.
+
+       #include <isl_set_polylib.h>
+       __isl_give isl_basic_set *isl_basic_set_new_from_polylib(
+               Polyhedron *P, __isl_take isl_dim *dim);
+       Polyhedron *isl_basic_set_to_polylib(
+               __isl_keep isl_basic_set *bset);
+       __isl_give isl_set *isl_set_new_from_polylib(Polyhedron *D,
+               __isl_take isl_dim *dim);
+       Polyhedron *isl_set_to_polylib(__isl_keep isl_set *set);
+
+       #include <isl_map_polylib.h>
+       __isl_give isl_basic_map *isl_basic_map_new_from_polylib(
+               Polyhedron *P, __isl_take isl_dim *dim);
+       __isl_give isl_map *isl_map_new_from_polylib(Polyhedron *D,
+               __isl_take isl_dim *dim);
+       Polyhedron *isl_basic_map_to_polylib(
+               __isl_keep isl_basic_map *bmap);
+       Polyhedron *isl_map_to_polylib(__isl_keep isl_map *map);
index 69ad9ad..231575e 100644 (file)
@@ -1,4 +1,3 @@
 #undef GCC_WARN_UNUSED_RESULT
 
-#undef ISL_POLYLIB
 #undef ISL_PIPLIB
index e1e8a56..60f3aac 100644 (file)
@@ -66,9 +66,6 @@ struct isl_ctx {
        int                     n_cached;
        struct isl_blk          cache[ISL_BLK_CACHE_SIZE];
        struct isl_hash_table   name_hash;
-#ifdef ISL_POLYLIB
-       unsigned                MaxRays;
-#endif
 };
 typedef struct isl_ctx isl_ctx;
 
diff --git a/include/isl_map_polylib.h b/include/isl_map_polylib.h
deleted file mode 100644 (file)
index 91382e4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ISL_MAP_POLYLIB_H
-#define ISL_MAP_POLYLIB_H
-
-#include <isl_dim.h>
-#include <isl_map.h>
-#include <isl_polylib.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-__isl_give isl_basic_map *isl_basic_map_new_from_polylib(Polyhedron *P,
-                       __isl_take isl_dim *dim);
-__isl_give isl_map *isl_map_new_from_polylib(Polyhedron *D,
-                       __isl_take isl_dim *dim);
-Polyhedron *isl_basic_map_to_polylib(__isl_keep isl_basic_map *bmap);
-Polyhedron *isl_map_to_polylib(__isl_keep isl_map *map);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
diff --git a/include/isl_polylib.h b/include/isl_polylib.h
deleted file mode 100644 (file)
index b2c500d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef ISL_POLYLIB_H
-#define ISL_POLYLIB_H
-
-#include <isl_ctx.h>
-#ifndef ISL_POLYLIB
-#error "no polylib"
-#endif
-
-#include <polylib/polylibgmp.h>
-
-#endif
diff --git a/include/isl_set_polylib.h b/include/isl_set_polylib.h
deleted file mode 100644 (file)
index 1408df1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ISL_SET_POLYLIB_H
-#define ISL_SET_POLYLIB_H
-
-#include <isl_set.h>
-#include <isl_polylib.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-__isl_give isl_basic_set *isl_basic_set_new_from_polylib(Polyhedron *P,
-                       __isl_take isl_dim *dim);
-Polyhedron *isl_basic_set_to_polylib(__isl_keep isl_basic_set *bset);
-
-__isl_give isl_set *isl_set_new_from_polylib(Polyhedron *D,
-                       __isl_take isl_dim *dim);
-Polyhedron *isl_set_to_polylib(__isl_keep isl_set *set);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
index 13f9e8a..940f51a 100644 (file)
--- a/isl_ctx.c
+++ b/isl_ctx.c
@@ -1,8 +1,5 @@
 #include "isl_ctx.h"
 #include "isl_vec.h"
-#ifdef ISL_POLYLIB
-#include <polylib/polylibgmp.h>
-#endif
 
 isl_ctx *isl_ctx_alloc_with_options(struct isl_options *opt)
 {
@@ -35,10 +32,6 @@ isl_ctx *isl_ctx_alloc_with_options(struct isl_options *opt)
 
        ctx->n_cached = 0;
 
-#ifdef ISL_POLYLIB
-       ctx->MaxRays = POL_NO_DUAL | POL_INTEGER;
-#endif
-
        return ctx;
 error:
        free(ctx);
diff --git a/isl_map_polylib.c b/isl_map_polylib.c
deleted file mode 100644 (file)
index 7d4bc44..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-#include "isl_set.h"
-#include "isl_map.h"
-#include "isl_seq.h"
-#include "isl_set_polylib.h"
-#include "isl_map_polylib.h"
-#include "isl_map_private.h"
-
-static void copy_values_from(isl_int *dst, Value *src, unsigned n)
-{
-       int i;
-
-       for (i = 0; i < n; ++i)
-               value_assign(dst[i], src[i]);
-}
-
-static void copy_values_to(Value *dst, isl_int *src, unsigned n)
-{
-       int i;
-
-       for (i = 0; i < n; ++i)
-               value_assign(dst[i], src[i]);
-}
-
-static void copy_constraint_from(isl_int *dst, Value *src,
-               unsigned nparam, unsigned dim, unsigned extra)
-{
-       copy_values_from(dst, src+1+dim+extra+nparam, 1);
-       copy_values_from(dst+1, src+1+dim+extra, nparam);
-       copy_values_from(dst+1+nparam, src+1, dim);
-       copy_values_from(dst+1+nparam+dim, src+1+dim, extra);
-}
-
-static void copy_constraint_to(Value *dst, isl_int *src,
-               unsigned nparam, unsigned dim, unsigned extra)
-{
-       copy_values_to(dst+1+dim+extra+nparam, src, 1);
-       copy_values_to(dst+1+dim+extra, src+1, nparam);
-       copy_values_to(dst+1, src+1+nparam, dim);
-       copy_values_to(dst+1+dim, src+1+nparam+dim, extra);
-}
-
-static int add_equality(struct isl_ctx *ctx, struct isl_basic_map *bmap,
-                        Value *constraint)
-{
-       unsigned nparam;
-       unsigned n_in;
-       unsigned n_out;
-       int i = isl_basic_map_alloc_equality(bmap);
-       if (i < 0)
-               return -1;
-       nparam = isl_basic_map_n_param(bmap);
-       n_in = isl_basic_map_n_in(bmap);
-       n_out = isl_basic_map_n_out(bmap);
-       copy_constraint_from(bmap->eq[i], constraint, nparam,
-                            n_in + n_out, bmap->extra);
-       return 0;
-}
-
-static int add_inequality(struct isl_ctx *ctx, struct isl_basic_map *bmap,
-                        Value *constraint)
-{
-       unsigned nparam;
-       unsigned n_in;
-       unsigned n_out;
-       int i = isl_basic_map_alloc_inequality(bmap);
-       if (i < 0)
-               return -1;
-       nparam = isl_basic_map_n_param(bmap);
-       n_in = isl_basic_map_n_in(bmap);
-       n_out = isl_basic_map_n_out(bmap);
-       copy_constraint_from(bmap->ineq[i], constraint, nparam,
-                            n_in + n_out, bmap->extra);
-       return 0;
-}
-
-static struct isl_basic_map *copy_constraints(
-                       struct isl_ctx *ctx, struct isl_basic_map *bmap,
-                       Polyhedron *P)
-{
-       int i;
-       unsigned total = isl_basic_map_total_dim(bmap);
-
-       for (i = 0; i < P->NbConstraints; ++i) {
-               if (value_zero_p(P->Constraint[i][0])) {
-                       if (add_equality(ctx, bmap, P->Constraint[i]))
-                               goto error;
-               } else {
-                       if (add_inequality(ctx, bmap, P->Constraint[i]))
-                               goto error;
-               }
-       }
-       for (i = 0; i < bmap->extra; ++i) {
-               int j = isl_basic_map_alloc_div(bmap);
-               if (j == -1)
-                       goto error;
-               isl_seq_clr(bmap->div[j], 1+1+total);
-       }
-       return bmap;
-error:
-       isl_basic_map_free(bmap);
-       return NULL;
-}
-
-struct isl_basic_set *isl_basic_set_new_from_polylib(Polyhedron *P,
-                       struct isl_dim *dim)
-{
-       if (!dim)
-               return NULL;
-       isl_assert(dim->ctx, dim->n_in == 0, return NULL);
-
-       return (struct isl_basic_set *)
-               isl_basic_map_new_from_polylib(P, dim);
-}
-
-struct isl_basic_map *isl_basic_map_new_from_polylib(Polyhedron *P,
-                       struct isl_dim *dim)
-{
-       struct isl_basic_map *bmap;
-       unsigned extra;
-
-       if (!dim)
-               return NULL;
-
-       isl_assert(dim->ctx, P, goto error);
-       isl_assert(dim->ctx, P->Dimension >= isl_dim_total(dim), goto error);
-
-       extra = P->Dimension - isl_dim_total(dim);
-       bmap = isl_basic_map_alloc_dim(dim, extra,
-                                       P->NbEq, P->NbConstraints - P->NbEq);
-       if (!bmap)
-               return NULL;
-
-       bmap = copy_constraints(dim->ctx, bmap, P);
-       bmap = isl_basic_map_simplify(bmap);
-       return isl_basic_map_finalize(bmap);
-error:
-       isl_dim_free(dim);
-       return NULL;
-}
-
-struct isl_set *isl_set_new_from_polylib(Polyhedron *D, struct isl_dim *dim)
-{
-       struct isl_set *set = NULL;
-       Polyhedron *P;
-       int n = 0;
-
-       if (!dim)
-               return NULL;
-       isl_assert(dim->ctx, dim->n_in == 0, goto error);
-
-       for (P = D; P; P = P->next)
-               ++n;
-
-       set = isl_set_alloc_dim(isl_dim_copy(dim), n, ISL_MAP_DISJOINT);
-       if (!set)
-               goto error;
-
-       for (P = D; P; P = P->next)
-               isl_set_add(set,
-                   isl_basic_set_new_from_polylib(P, isl_dim_copy(dim)));
-       isl_dim_free(dim);
-       set = isl_set_remove_empty_parts(set);
-       return set;
-error:
-       isl_dim_free(dim);
-       return NULL;
-}
-
-struct isl_map *isl_map_new_from_polylib(Polyhedron *D, struct isl_dim *dim)
-{
-       struct isl_map *map = NULL;
-       Polyhedron *P;
-       int n = 0;
-
-       if (!dim)
-               return NULL;
-
-       for (P = D; P; P = P->next)
-               ++n;
-
-       map = isl_map_alloc_dim(isl_dim_copy(dim), n, ISL_MAP_DISJOINT);
-       if (!map)
-               goto error;
-
-       for (P = D; P; P = P->next)
-               isl_map_add(map,
-                   isl_basic_map_new_from_polylib(P, isl_dim_copy(dim)));
-       isl_dim_free(dim);
-       map = isl_map_remove_empty_parts(map);
-       return map;
-error:
-       isl_dim_free(dim);
-       return NULL;
-}
-
-Polyhedron *isl_basic_map_to_polylib(struct isl_basic_map *bmap)
-{
-       int i;
-       Matrix *M;
-       Polyhedron *P;
-       unsigned off;
-       unsigned nparam;
-       unsigned n_in;
-       unsigned n_out;
-
-       if (!bmap)
-               return NULL;
-
-       nparam = isl_basic_map_n_param(bmap);
-       n_in = isl_basic_map_n_in(bmap);
-       n_out = isl_basic_map_n_out(bmap);
-       M = Matrix_Alloc(bmap->n_eq + bmap->n_ineq,
-                1 + n_in + n_out + bmap->n_div + nparam + 1);
-       for (i = 0; i < bmap->n_eq; ++i) {
-               value_set_si(M->p[i][0], 0);
-               copy_constraint_to(M->p[i], bmap->eq[i],
-                          nparam, n_in + n_out, bmap->n_div);
-       }
-       off = bmap->n_eq;
-       for (i = 0; i < bmap->n_ineq; ++i) {
-               value_set_si(M->p[off+i][0], 1);
-               copy_constraint_to(M->p[off+i], bmap->ineq[i],
-                          nparam, n_in + n_out, bmap->n_div);
-       }
-       P = Constraints2Polyhedron(M, bmap->ctx->MaxRays);
-       Matrix_Free(M);
-
-       return P;
-}
-
-Polyhedron *isl_map_to_polylib(struct isl_map *map)
-{
-       int i;
-       Polyhedron *R = NULL;
-       Polyhedron **next = &R;
-
-       if (!map)
-               return NULL;
-
-       for (i = 0; i < map->n; ++i) {
-               *next = isl_basic_map_to_polylib(map->p[i]);
-               next = &(*next)->next;
-       }
-
-       return R ? R : Empty_Polyhedron(isl_dim_total(map->dim));
-}
-
-Polyhedron *isl_basic_set_to_polylib(struct isl_basic_set *bset)
-{
-       return isl_basic_map_to_polylib((struct isl_basic_map *)bset);
-}
-
-Polyhedron *isl_set_to_polylib(struct isl_set *set)
-{
-       return isl_map_to_polylib((struct isl_map *)set);
-}