diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2009-02-11 19:22:36 +0100 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2009-02-15 23:47:03 +0100 |
commit | 8c66b5046a36b0dcff0a012064967b97ebc3b3e2 (patch) | |
tree | 355e84d6f98cd478fe1ea1e0d0456cb24627e391 /isl_vec.c | |
parent | e6deb2c609acf3386919101684738088361b36d7 (diff) | |
download | isl-8c66b5046a36b0dcff0a012064967b97ebc3b3e2.tar.gz isl-8c66b5046a36b0dcff0a012064967b97ebc3b3e2.tar.bz2 isl-8c66b5046a36b0dcff0a012064967b97ebc3b3e2.zip |
fix serious error in isl_mat_parameter_compression
The old version would sometimes remove valid solutions.
Since isl_mat_parameter_compression is used during simplification
on practically any set containing existentially quantified variables
involved in equalities, any such set could get corrupted.
Diffstat (limited to 'isl_vec.c')
-rw-r--r-- | isl_vec.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -30,6 +30,31 @@ struct isl_vec *isl_vec_copy(struct isl_ctx *ctx, struct isl_vec *vec) return vec; } +struct isl_vec *isl_vec_dup(struct isl_ctx *ctx, struct isl_vec *vec) +{ + struct isl_vec *vec2; + + if (!vec) + return NULL; + vec2 = isl_vec_alloc(ctx, vec->size); + isl_seq_cpy(vec2->block.data, vec->block.data, vec->size); + return vec2; +} + +struct isl_vec *isl_vec_cow(struct isl_ctx *ctx, struct isl_vec *vec) +{ + struct isl_vec *vec2; + if (!vec) + return NULL; + + if (vec->ref == 1) + return vec; + + vec2 = isl_vec_dup(ctx, vec); + isl_vec_free(ctx, vec); + return vec2; +} + void isl_vec_free(struct isl_ctx *ctx, struct isl_vec *vec) { if (!vec) @@ -54,3 +79,8 @@ void isl_vec_dump(struct isl_ctx *ctx, struct isl_vec *vec, } fprintf(out, "]\n"); } + +void isl_vec_lcm(struct isl_ctx *ctx, struct isl_vec *vec, isl_int *lcm) +{ + isl_seq_lcm(vec->block.data, vec->size, lcm); +} |