summaryrefslogtreecommitdiff
path: root/isl_map.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2009-02-10 17:30:43 +0100
committerSven Verdoolaege <skimo@kotnet.org>2009-02-11 11:29:10 +0100
commit0ee7d3b1a0ec3d6fec9a2e9271a6b2eede7f45fc (patch)
tree6607b91a698b2b9d7250291beb14c0e8c1348759 /isl_map.c
parent080db2d8d42d26910362eeca567e8c54e7626ed3 (diff)
downloadisl-0ee7d3b1a0ec3d6fec9a2e9271a6b2eede7f45fc.tar.gz
isl-0ee7d3b1a0ec3d6fec9a2e9271a6b2eede7f45fc.tar.bz2
isl-0ee7d3b1a0ec3d6fec9a2e9271a6b2eede7f45fc.zip
add isl_basic_map_neg
Diffstat (limited to 'isl_map.c')
-rw-r--r--isl_map.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/isl_map.c b/isl_map.c
index 9d0c9d19..99d247db 100644
--- a/isl_map.c
+++ b/isl_map.c
@@ -1820,6 +1820,31 @@ error:
return NULL;
}
+/* Given a basic map A -> f(A), construct A -> -f(A).
+ */
+struct isl_basic_map *isl_basic_map_neg(struct isl_basic_map *bmap)
+{
+ int i, j;
+ unsigned off, n;
+
+ bmap = isl_basic_map_cow(bmap);
+ if (!bmap)
+ return NULL;
+
+ n = isl_basic_map_dim(bmap, isl_dim_out);
+ off = basic_map_offset(bmap, isl_dim_out);
+ for (i = 0; i < bmap->n_eq; ++i)
+ for (j = 0; j < n; ++j)
+ isl_int_neg(bmap->eq[i][off+j], bmap->eq[i][off+j]);
+ for (i = 0; i < bmap->n_ineq; ++i)
+ for (j = 0; j < n; ++j)
+ isl_int_neg(bmap->ineq[i][off+j], bmap->ineq[i][off+j]);
+ for (i = 0; i < bmap->n_div; ++i)
+ for (j = 0; j < n; ++j)
+ isl_int_neg(bmap->div[i][1+off+j], bmap->div[i][1+off+j]);
+ return isl_basic_map_finalize(bmap);
+}
+
static struct isl_basic_map *var_equal(struct isl_ctx *ctx,
struct isl_basic_map *bmap, unsigned pos)
{