diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2009-04-15 20:43:08 +0200 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2009-05-06 11:23:45 +0200 |
commit | b3acbdec6ee87a2c00278f47556b7de0653a7687 (patch) | |
tree | b8e12ff8d54ffa3ca145f4e9a613a9651040eead | |
parent | 5148fa1588494226bfb7b1c5278dea3e316e6372 (diff) | |
download | isl-b3acbdec6ee87a2c00278f47556b7de0653a7687.tar.gz isl-b3acbdec6ee87a2c00278f47556b7de0653a7687.tar.bz2 isl-b3acbdec6ee87a2c00278f47556b7de0653a7687.zip |
privately export isl_mat_unimodular_complete
-rw-r--r-- | isl_equalities.c | 30 | ||||
-rw-r--r-- | isl_mat.c | 26 | ||||
-rw-r--r-- | isl_mat.h | 3 |
3 files changed, 31 insertions, 28 deletions
diff --git a/isl_equalities.c b/isl_equalities.c index 67fe05f9..0632ddd8 100644 --- a/isl_equalities.c +++ b/isl_equalities.c @@ -104,32 +104,6 @@ error: return NULL; } -static struct isl_mat *unimodular_complete(struct isl_ctx *ctx, - struct isl_mat *M, int row) -{ - int r; - struct isl_mat *H = NULL, *Q = NULL; - - isl_assert(ctx, M->n_row == M->n_col, goto error); - M->n_row = row; - H = isl_mat_left_hermite(ctx, isl_mat_copy(ctx, M), 0, NULL, &Q); - M->n_row = M->n_col; - if (!H) - goto error; - for (r = 0; r < row; ++r) - isl_assert(ctx, isl_int_is_one(H->row[r][r]), goto error); - for (r = row; r < M->n_row; ++r) - isl_seq_cpy(M->row[r], Q->row[r], M->n_col); - isl_mat_free(ctx, H); - isl_mat_free(ctx, Q); - return M; -error: - isl_mat_free(ctx, H); - isl_mat_free(ctx, Q); - isl_mat_free(ctx, M); - return NULL; -} - /* Compute and return the matrix * * U_1^{-1} diag(d_1, 1, ..., 1) @@ -147,7 +121,7 @@ static struct isl_mat *parameter_compression_1(struct isl_ctx *ctx, if (!U) return NULL; isl_seq_cpy(U->row[0], B->row[0] + 1, B->n_col - 1); - U = unimodular_complete(ctx, U, 1); + U = isl_mat_unimodular_complete(ctx, U, 1); U = isl_mat_right_inverse(ctx, U); if (!U) return NULL; @@ -193,7 +167,7 @@ static struct isl_mat *parameter_compression_multi(struct isl_ctx *ctx, goto error; for (i = 0; i < B->n_row; ++i) { isl_seq_cpy(U->row[0], B->row[i] + 1, size); - U = unimodular_complete(ctx, U, 1); + U = isl_mat_unimodular_complete(ctx, U, 1); if (!U) goto error; isl_int_divexact(D, D, d->block.data[i]); @@ -987,3 +987,29 @@ void isl_mat_col_mul(struct isl_mat *mat, int dst_col, isl_int f, int src_col) for (i = 0; i < mat->n_row; ++i) isl_int_mul(mat->row[i][dst_col], f, mat->row[i][src_col]); } + +struct isl_mat *isl_mat_unimodular_complete(struct isl_ctx *ctx, + struct isl_mat *M, int row) +{ + int r; + struct isl_mat *H = NULL, *Q = NULL; + + isl_assert(ctx, M->n_row == M->n_col, goto error); + M->n_row = row; + H = isl_mat_left_hermite(ctx, isl_mat_copy(ctx, M), 0, NULL, &Q); + M->n_row = M->n_col; + if (!H) + goto error; + for (r = 0; r < row; ++r) + isl_assert(ctx, isl_int_is_one(H->row[r][r]), goto error); + for (r = row; r < M->n_row; ++r) + isl_seq_cpy(M->row[r], Q->row[r], M->n_col); + isl_mat_free(ctx, H); + isl_mat_free(ctx, Q); + return M; +error: + isl_mat_free(ctx, H); + isl_mat_free(ctx, Q); + isl_mat_free(ctx, M); + return NULL; +} @@ -77,6 +77,9 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_basic_set *bset, struct isl_mat *mat); struct isl_set *isl_set_preimage(struct isl_set *set, struct isl_mat *mat); +struct isl_mat *isl_mat_unimodular_complete(struct isl_ctx *ctx, + struct isl_mat *M, int row); + void isl_mat_dump(struct isl_ctx *ctx, struct isl_mat *mat, FILE *out, int indent); |