add isl_closure test application
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 14 Feb 2010 18:04:13 +0000 (19:04 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 15 Feb 2010 10:41:36 +0000 (11:41 +0100)
Makefile.am
closure.c [new file with mode: 0644]

index 85815bb..eaf3bec 100644 (file)
@@ -6,7 +6,8 @@ ACLOCAL_AMFLAGS = -I m4
 lib_LTLIBRARIES = libisl.la
 noinst_PROGRAMS = isl_test isl_polyhedron_sample isl_pip \
        isl_polyhedron_minimize isl_polytope_scan \
-       isl_polyhedron_detect_equalities isl_cat
+       isl_polyhedron_detect_equalities isl_cat \
+       isl_closure
 TESTS = isl_test
 
 if HAVE_PIPLIB
@@ -128,6 +129,12 @@ isl_cat_LDADD = libisl.la
 isl_cat_SOURCES = \
        cat.c
 
+isl_closure_CPPFLAGS = -I$(srcdir)/include -Iinclude/ \
+       @GMP_CPPFLAGS@
+isl_closure_LDADD = libisl.la
+isl_closure_SOURCES = \
+       closure.c
+
 nodist_pkginclude_HEADERS = \
        include/isl_config.h \
        include/isl_stdint.h
diff --git a/closure.c b/closure.c
new file mode 100644 (file)
index 0000000..7f415e7
--- /dev/null
+++ b/closure.c
@@ -0,0 +1,25 @@
+#include <isl_map.h>
+
+int main(int argc, char **argv)
+{
+       struct isl_ctx *ctx;
+       struct isl_map *map;
+       int exact;
+
+       ctx = isl_ctx_alloc();
+
+       map = isl_map_read_from_file(ctx, stdin, -1);
+       map = isl_map_transitive_closure(map, &exact);
+       if (!exact)
+               printf("# NOT exact\n");
+       isl_map_print(map, stdout, 0, ISL_FORMAT_ISL);
+       map = isl_map_compute_divs(map);
+       map = isl_map_coalesce(map);
+       printf("# coalesced\n");
+       isl_map_print(map, stdout, 0, ISL_FORMAT_ISL);
+       isl_map_free(map);
+
+       isl_ctx_free(ctx);
+
+       return 0;
+}