summaryrefslogtreecommitdiff
path: root/isl_mat.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2008-09-09 10:09:34 +0200
committerSven Verdoolaege <skimo@kotnet.org>2008-10-11 23:37:28 +0200
commit7cd47d61a34916dd23e658e3b8bac9b2abfe8b1d (patch)
tree67402ef7f2793bc83f7169699891f0a92277898d /isl_mat.c
parent608fe1dc7d7df7c60b18af546ec719e3a4c7ee81 (diff)
downloadisl-7cd47d61a34916dd23e658e3b8bac9b2abfe8b1d.tar.gz
isl-7cd47d61a34916dd23e658e3b8bac9b2abfe8b1d.tar.bz2
isl-7cd47d61a34916dd23e658e3b8bac9b2abfe8b1d.zip
add struct_ctx field to isl_set and isl_map
Since isl_sets and isl_maps now know which isl_ctx they belong to, the isl_ctx argument of many functions can be dropped.
Diffstat (limited to 'isl_mat.c')
-rw-r--r--isl_mat.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/isl_mat.c b/isl_mat.c
index 4b3b20a7..10b65449 100644
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -238,7 +238,7 @@ static void exchange(struct isl_ctx *ctx, struct isl_mat *M, struct isl_mat **U,
isl_mat_swap_rows(ctx, *Q, i, j);
}
-static void subtract(struct isl_ctx *ctx, struct isl_mat *M, struct isl_mat **U,
+static void subtract(struct isl_mat *M, struct isl_mat **U,
struct isl_mat **Q, unsigned row, unsigned i, unsigned j, isl_int m)
{
int r, c;
@@ -323,7 +323,7 @@ struct isl_mat *isl_mat_left_hermite(struct isl_ctx *ctx,
M->n_col-first)) != -1) {
first += off;
isl_int_fdiv_q(c, M->row[row][first], M->row[row][col]);
- subtract(ctx, M, U, Q, row, col, first, c);
+ subtract(M, U, Q, row, col, first, c);
if (!isl_int_is_zero(M->row[row][first]))
exchange(ctx, M, U, Q, row, first, col);
else
@@ -338,7 +338,7 @@ struct isl_mat *isl_mat_left_hermite(struct isl_ctx *ctx,
isl_int_fdiv_q(c, M->row[row][i], M->row[row][col]);
if (isl_int_is_zero(c))
continue;
- subtract(ctx, M, U, Q, row, col, i, c);
+ subtract(M, U, Q, row, col, i, c);
}
++col;
}
@@ -581,7 +581,7 @@ struct isl_mat *isl_mat_right_inverse(struct isl_ctx *ctx,
first += off;
isl_int_fdiv_q(a, mat->row[row][first],
mat->row[row][row]);
- subtract(ctx, mat, &inv, NULL, row, row, first, a);
+ subtract(mat, &inv, NULL, row, row, first, a);
if (!isl_int_is_zero(mat->row[row][first]))
exchange(ctx, mat, &inv, NULL, row, row, first);
else
@@ -683,7 +683,7 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx,
if (!bset || !mat)
goto error;
- bset = isl_basic_set_cow(ctx, bset);
+ bset = isl_basic_set_cow(bset);
if (!bset)
goto error;
@@ -692,7 +692,7 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx,
isl_assert(ctx, 1+bset->dim == mat->n_row, goto error);
if (mat->n_col > mat->n_row)
- bset = isl_basic_set_extend(ctx, bset, 0, mat->n_col-1, 0,
+ bset = isl_basic_set_extend(bset, 0, mat->n_col-1, 0,
0, 0);
else {
bset->dim -= mat->n_row - mat->n_col;
@@ -719,14 +719,14 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx,
}
isl_mat_free(ctx, t);
- bset = isl_basic_set_simplify(ctx, bset);
- bset = isl_basic_set_finalize(ctx, bset);
+ bset = isl_basic_set_simplify(bset);
+ bset = isl_basic_set_finalize(bset);
return bset;
error:
isl_mat_free(ctx, mat);
error2:
- isl_basic_set_free(ctx, bset);
+ isl_basic_set_free(bset);
return NULL;
}
@@ -735,10 +735,11 @@ struct isl_set *isl_set_preimage(struct isl_ctx *ctx,
{
int i;
- set = isl_set_cow(ctx, set);
+ set = isl_set_cow(set);
if (!set)
return NULL;
+ ctx = set->ctx;
for (i = 0; i < set->n; ++i) {
set->p[i] = isl_basic_set_preimage(ctx, set->p[i],
isl_mat_copy(ctx, mat));
@@ -750,7 +751,7 @@ struct isl_set *isl_set_preimage(struct isl_ctx *ctx,
isl_mat_free(ctx, mat);
return set;
error:
- isl_set_free(ctx, set);
+ isl_set_free(set);
isl_mat_free(ctx, mat);
return NULL;
}