diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2010-05-25 10:22:50 +0200 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2010-06-12 13:16:36 +0200 |
commit | 26c87602c7145486012c33646fc87b9b776c4262 (patch) | |
tree | 826088618b7c6b8c2da0ed398aa3cf7c077c7e3d /isl_morph.c | |
parent | 897cfaca100033a0e6e2159cf30a55d68f553e51 (diff) | |
download | isl-26c87602c7145486012c33646fc87b9b776c4262.tar.gz isl-26c87602c7145486012c33646fc87b9b776c4262.tar.bz2 isl-26c87602c7145486012c33646fc87b9b776c4262.zip |
isl_pw_qpolynomial_bound_range: fix removal of dims after compression
Diffstat (limited to 'isl_morph.c')
-rw-r--r-- | isl_morph.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/isl_morph.c b/isl_morph.c index 30f1154b..dc350f8b 100644 --- a/isl_morph.c +++ b/isl_morph.c @@ -95,11 +95,10 @@ __isl_give isl_dim *isl_morph_get_ran_dim(__isl_keep isl_morph *morph) return isl_dim_copy(morph->ran->dim); } -__isl_give isl_morph *isl_morph_drop_dims(__isl_take isl_morph *morph, +__isl_give isl_morph *isl_morph_remove_dom_dims(__isl_take isl_morph *morph, enum isl_dim_type type, unsigned first, unsigned n) { unsigned dom_offset; - unsigned ran_offset; if (n == 0) return morph; @@ -109,16 +108,39 @@ __isl_give isl_morph *isl_morph_drop_dims(__isl_take isl_morph *morph, return NULL; dom_offset = 1 + isl_dim_offset(morph->dom->dim, type); - ran_offset = 1 + isl_dim_offset(morph->ran->dim, type); - morph->dom = isl_basic_set_drop(morph->dom, type, first, n); - morph->ran = isl_basic_set_drop(morph->ran, type, first, n); + morph->dom = isl_basic_set_remove(morph->dom, type, first, n); morph->map = isl_mat_drop_cols(morph->map, dom_offset + first, n); + + morph->inv = isl_mat_drop_rows(morph->inv, dom_offset + first, n); + + if (morph->dom && morph->ran && morph->map && morph->inv) + return morph; + + isl_morph_free(morph); + return NULL; +} + +__isl_give isl_morph *isl_morph_remove_ran_dims(__isl_take isl_morph *morph, + enum isl_dim_type type, unsigned first, unsigned n) +{ + unsigned ran_offset; + + if (n == 0) + return morph; + + morph = isl_morph_cow(morph); + if (!morph) + return NULL; + + ran_offset = 1 + isl_dim_offset(morph->ran->dim, type); + + morph->ran = isl_basic_set_remove(morph->ran, type, first, n); + morph->map = isl_mat_drop_rows(morph->map, ran_offset + first, n); morph->inv = isl_mat_drop_cols(morph->inv, ran_offset + first, n); - morph->inv = isl_mat_drop_rows(morph->inv, dom_offset + first, n); if (morph->dom && morph->ran && morph->map && morph->inv) return morph; |