add transitive closure example from Kelly's 1996 paper
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 13 Feb 2010 20:15:40 +0000 (21:15 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 15 Feb 2010 10:41:36 +0000 (11:41 +0100)
isl_test.c

index ed5a69f..9d3cc5b 100644 (file)
@@ -785,6 +785,23 @@ void test_closure(struct isl_ctx *ctx)
        map = isl_map_transitive_closure(map, &exact);
        assert(exact);
        isl_map_free(map);
+
+       /* Kelly et al 1996, fig 12 */
+       map = isl_map_read_from_str(ctx,
+               "[n] -> { [i,j] -> [i2,j2] : i2 = i and j2 = j + 1 and "
+                       "1 <= i,j,j+1 <= n or "
+                       "j = n and j2 = 1 and i2 = i + 1 and "
+                       "1 <= i,i+1 <= n }", -1);
+       map = isl_map_transitive_closure(map, &exact);
+       assert(exact);
+       map2 = isl_map_read_from_str(ctx,
+               "[n] -> { [i,j] -> [i2,j2] : 1 <= j < j2 <= n and "
+                       "1 <= i <= n and i = i2 or "
+                       "1 <= i < i2 <= n and 1 <= j <= n and "
+                       "1 <= j2 <= n }", -1);
+       assert(isl_map_is_equal(map, map2));
+       isl_map_free(map2);
+       isl_map_free(map);
 }
 
 int main()