add isl_qpolynomial_dim
[isl.git] / isl_morph.c
blob80ec05acfa3540631ddd434ed975fe5639eac1f4
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
11 #include <isl_morph.h>
12 #include <isl_seq.h>
13 #include <isl_map_private.h>
14 #include <isl_dim_private.h>
15 #include <isl_equalities.h>
17 __isl_give isl_morph *isl_morph_alloc(
18 __isl_take isl_basic_set *dom, __isl_take isl_basic_set *ran,
19 __isl_take isl_mat *map, __isl_take isl_mat *inv)
21 isl_morph *morph;
23 if (!dom || !ran || !map || !inv)
24 goto error;
26 morph = isl_alloc_type(in_dim->ctx, struct isl_morph);
27 if (!morph)
28 goto error;
30 morph->ref = 1;
31 morph->dom = dom;
32 morph->ran = ran;
33 morph->map = map;
34 morph->inv = inv;
36 return morph;
37 error:
38 isl_basic_set_free(dom);
39 isl_basic_set_free(ran);
40 isl_mat_free(map);
41 isl_mat_free(inv);
42 return NULL;
45 __isl_give isl_morph *isl_morph_copy(__isl_keep isl_morph *morph)
47 if (!morph)
48 return NULL;
50 morph->ref++;
51 return morph;
54 __isl_give isl_morph *isl_morph_dup(__isl_keep isl_morph *morph)
56 if (!morph)
57 return NULL;
59 return isl_morph_alloc(isl_basic_set_copy(morph->dom),
60 isl_basic_set_copy(morph->ran),
61 isl_mat_copy(morph->map), isl_mat_copy(morph->inv));
64 __isl_give isl_morph *isl_morph_cow(__isl_take isl_morph *morph)
66 if (!morph)
67 return NULL;
69 if (morph->ref == 1)
70 return morph;
71 morph->ref--;
72 return isl_morph_dup(morph);
75 void isl_morph_free(__isl_take isl_morph *morph)
77 if (!morph)
78 return;
80 if (--morph->ref > 0)
81 return;
83 isl_basic_set_free(morph->dom);
84 isl_basic_set_free(morph->ran);
85 isl_mat_free(morph->map);
86 isl_mat_free(morph->inv);
87 free(morph);
90 __isl_give isl_dim *isl_morph_get_ran_dim(__isl_keep isl_morph *morph)
92 if (!morph)
93 return NULL;
95 return isl_dim_copy(morph->ran->dim);
98 __isl_give isl_morph *isl_morph_remove_dom_dims(__isl_take isl_morph *morph,
99 enum isl_dim_type type, unsigned first, unsigned n)
101 unsigned dom_offset;
103 if (n == 0)
104 return morph;
106 morph = isl_morph_cow(morph);
107 if (!morph)
108 return NULL;
110 dom_offset = 1 + isl_dim_offset(morph->dom->dim, type);
112 morph->dom = isl_basic_set_remove(morph->dom, type, first, n);
114 morph->map = isl_mat_drop_cols(morph->map, dom_offset + first, n);
116 morph->inv = isl_mat_drop_rows(morph->inv, dom_offset + first, n);
118 if (morph->dom && morph->ran && morph->map && morph->inv)
119 return morph;
121 isl_morph_free(morph);
122 return NULL;
125 __isl_give isl_morph *isl_morph_remove_ran_dims(__isl_take isl_morph *morph,
126 enum isl_dim_type type, unsigned first, unsigned n)
128 unsigned ran_offset;
130 if (n == 0)
131 return morph;
133 morph = isl_morph_cow(morph);
134 if (!morph)
135 return NULL;
137 ran_offset = 1 + isl_dim_offset(morph->ran->dim, type);
139 morph->ran = isl_basic_set_remove(morph->ran, type, first, n);
141 morph->map = isl_mat_drop_rows(morph->map, ran_offset + first, n);
143 morph->inv = isl_mat_drop_cols(morph->inv, ran_offset + first, n);
145 if (morph->dom && morph->ran && morph->map && morph->inv)
146 return morph;
148 isl_morph_free(morph);
149 return NULL;
152 void isl_morph_dump(__isl_take isl_morph *morph, FILE *out)
154 if (!morph)
155 return;
157 isl_basic_set_print(morph->dom, out, 0, "", "", ISL_FORMAT_ISL);
158 isl_basic_set_print(morph->ran, out, 0, "", "", ISL_FORMAT_ISL);
159 isl_mat_dump(morph->map, out, 4);
160 isl_mat_dump(morph->inv, out, 4);
163 __isl_give isl_morph *isl_morph_identity(__isl_keep isl_basic_set *bset)
165 isl_mat *id;
166 isl_basic_set *universe;
167 unsigned total;
169 if (!bset)
170 return NULL;
172 total = isl_basic_set_total_dim(bset);
173 id = isl_mat_identity(bset->ctx, 1 + total);
174 universe = isl_basic_set_universe(isl_dim_copy(bset->dim));
176 return isl_morph_alloc(universe, isl_basic_set_copy(universe),
177 id, isl_mat_copy(id));
180 /* Create a(n identity) morphism between empty sets of the same dimension
181 * a "bset".
183 __isl_give isl_morph *isl_morph_empty(__isl_keep isl_basic_set *bset)
185 isl_mat *id;
186 isl_basic_set *empty;
187 unsigned total;
189 if (!bset)
190 return NULL;
192 total = isl_basic_set_total_dim(bset);
193 id = isl_mat_identity(bset->ctx, 1 + total);
194 empty = isl_basic_set_empty(isl_dim_copy(bset->dim));
196 return isl_morph_alloc(empty, isl_basic_set_copy(empty),
197 id, isl_mat_copy(id));
200 /* Given a matrix that maps a (possibly) parametric domain to
201 * a parametric domain, add in rows that map the "nparam" parameters onto
202 * themselves.
204 static __isl_give isl_mat *insert_parameter_rows(__isl_take isl_mat *mat,
205 unsigned nparam)
207 int i;
209 if (nparam == 0)
210 return mat;
211 if (!mat)
212 return NULL;
214 mat = isl_mat_insert_rows(mat, 1, nparam);
215 if (!mat)
216 return NULL;
218 for (i = 0; i < nparam; ++i) {
219 isl_seq_clr(mat->row[1 + i], mat->n_col);
220 isl_int_set(mat->row[1 + i][1 + i], mat->row[0][0]);
223 return mat;
226 /* Construct a basic set described by the "n" equalities of "bset" starting
227 * at "first".
229 static __isl_give isl_basic_set *copy_equalities(__isl_keep isl_basic_set *bset,
230 unsigned first, unsigned n)
232 int i, k;
233 isl_basic_set *eq;
234 unsigned total;
236 isl_assert(bset->ctx, bset->n_div == 0, return NULL);
238 total = isl_basic_set_total_dim(bset);
239 eq = isl_basic_set_alloc_dim(isl_dim_copy(bset->dim), 0, n, 0);
240 if (!eq)
241 return NULL;
242 for (i = 0; i < n; ++i) {
243 k = isl_basic_set_alloc_equality(eq);
244 if (k < 0)
245 goto error;
246 isl_seq_cpy(eq->eq[k], bset->eq[first + k], 1 + total);
249 return eq;
250 error:
251 isl_basic_set_free(eq);
252 return NULL;
255 /* Given a basic set, exploit the equalties in the a basic set to construct
256 * a morphishm that maps the basic set to a lower-dimensional space.
257 * Specifically, the morphism reduces the number of dimensions of type "type".
259 * This function is a slight generalization of isl_mat_variable_compression
260 * in that it allows the input to be parametric and that it allows for the
261 * compression of either parameters or set variables.
263 * We first select the equalities of interest, that is those that involve
264 * variables of type "type" and no later variables.
265 * Denote those equalities as
267 * -C(p) + M x = 0
269 * where C(p) depends on the parameters if type == isl_dim_set and
270 * is a constant if type == isl_dim_param.
272 * First compute the (left) Hermite normal form of M,
274 * M [U1 U2] = M U = H = [H1 0]
275 * or
276 * M = H Q = [H1 0] [Q1]
277 * [Q2]
279 * with U, Q unimodular, Q = U^{-1} (and H lower triangular).
280 * Define the transformed variables as
282 * x = [U1 U2] [ x1' ] = [U1 U2] [Q1] x
283 * [ x2' ] [Q2]
285 * The equalities then become
287 * -C(p) + H1 x1' = 0 or x1' = H1^{-1} C(p) = C'(p)
289 * If the denominator of the constant term does not divide the
290 * the common denominator of the parametric terms, then every
291 * integer point is mapped to a non-integer point and then the original set has no
292 * integer solutions (since the x' are a unimodular transformation
293 * of the x). In this case, an empty morphism is returned.
294 * Otherwise, the transformation is given by
296 * x = U1 H1^{-1} C(p) + U2 x2'
298 * The inverse transformation is simply
300 * x2' = Q2 x
302 * Both matrices are extended to map the full original space to the full
303 * compressed space.
305 __isl_give isl_morph *isl_basic_set_variable_compression(
306 __isl_keep isl_basic_set *bset, enum isl_dim_type type)
308 unsigned otype;
309 unsigned ntype;
310 unsigned orest;
311 unsigned nrest;
312 unsigned total;
313 int f_eq, n_eq;
314 isl_dim *dim;
315 isl_mat *H, *U, *Q, *C = NULL, *H1, *U1, *U2;
316 isl_basic_set *dom, *ran;
318 if (!bset)
319 return NULL;
321 if (isl_basic_set_fast_is_empty(bset))
322 return isl_morph_empty(bset);
324 isl_assert(bset->ctx, bset->n_div == 0, return NULL);
326 otype = 1 + isl_dim_offset(bset->dim, type);
327 ntype = isl_basic_set_dim(bset, type);
328 orest = otype + ntype;
329 nrest = isl_basic_set_total_dim(bset) - (orest - 1);
331 for (f_eq = 0; f_eq < bset->n_eq; ++f_eq)
332 if (isl_seq_first_non_zero(bset->eq[f_eq] + orest, nrest) == -1)
333 break;
334 for (n_eq = 0; f_eq + n_eq < bset->n_eq; ++n_eq)
335 if (isl_seq_first_non_zero(bset->eq[f_eq + n_eq] + otype, ntype) == -1)
336 break;
337 if (n_eq == 0)
338 return isl_morph_identity(bset);
340 H = isl_mat_sub_alloc(bset->ctx, bset->eq, f_eq, n_eq, otype, ntype);
341 H = isl_mat_left_hermite(H, 0, &U, &Q);
342 if (!H || !U || !Q)
343 goto error;
344 Q = isl_mat_drop_rows(Q, 0, n_eq);
345 Q = isl_mat_diagonal(isl_mat_identity(bset->ctx, otype), Q);
346 Q = isl_mat_diagonal(Q, isl_mat_identity(bset->ctx, nrest));
347 C = isl_mat_alloc(bset->ctx, 1 + n_eq, otype);
348 if (!C)
349 goto error;
350 isl_int_set_si(C->row[0][0], 1);
351 isl_seq_clr(C->row[0] + 1, otype - 1);
352 isl_mat_sub_neg(C->ctx, C->row + 1, bset->eq + f_eq, n_eq, 0, 0, otype);
353 H1 = isl_mat_sub_alloc(H->ctx, H->row, 0, H->n_row, 0, H->n_row);
354 H1 = isl_mat_lin_to_aff(H1);
355 C = isl_mat_inverse_product(H1, C);
356 if (!C)
357 goto error;
358 isl_mat_free(H);
360 if (!isl_int_is_one(C->row[0][0])) {
361 int i;
362 isl_int g;
364 isl_int_init(g);
365 for (i = 0; i < n_eq; ++i) {
366 isl_seq_gcd(C->row[1 + i] + 1, otype - 1, &g);
367 isl_int_gcd(g, g, C->row[0][0]);
368 if (!isl_int_is_divisible_by(C->row[1 + i][0], g))
369 break;
371 isl_int_clear(g);
373 if (i < n_eq) {
374 isl_mat_free(C);
375 isl_mat_free(U);
376 isl_mat_free(Q);
377 return isl_morph_empty(bset);
380 C = isl_mat_normalize(C);
383 U1 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row, 0, n_eq);
384 U1 = isl_mat_lin_to_aff(U1);
385 U2 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row, n_eq, U->n_row - n_eq);
386 U2 = isl_mat_lin_to_aff(U2);
387 isl_mat_free(U);
389 C = isl_mat_product(U1, C);
390 C = isl_mat_aff_direct_sum(C, U2);
391 C = insert_parameter_rows(C, otype - 1);
392 C = isl_mat_diagonal(C, isl_mat_identity(bset->ctx, nrest));
394 dim = isl_dim_copy(bset->dim);
395 dim = isl_dim_drop(dim, type, 0, ntype);
396 dim = isl_dim_add(dim, type, ntype - n_eq);
397 ran = isl_basic_set_universe(dim);
398 dom = copy_equalities(bset, f_eq, n_eq);
400 return isl_morph_alloc(dom, ran, Q, C);
401 error:
402 isl_mat_free(C);
403 isl_mat_free(H);
404 isl_mat_free(U);
405 isl_mat_free(Q);
406 return NULL;
409 /* Construct a parameter compression for "bset".
410 * We basically just call isl_mat_parameter_compression with the right input
411 * and then extend the resulting matrix to include the variables.
413 * Let the equalities be given as
415 * B(p) + A x = 0
417 * and let [H 0] be the Hermite Normal Form of A, then
419 * H^-1 B(p)
421 * needs to be integer, so we impose that each row is divisible by
422 * the denominator.
424 __isl_give isl_morph *isl_basic_set_parameter_compression(
425 __isl_keep isl_basic_set *bset)
427 unsigned nparam;
428 unsigned nvar;
429 int n_eq;
430 isl_mat *H, *B;
431 isl_vec *d;
432 isl_mat *map, *inv;
433 isl_basic_set *dom, *ran;
435 if (!bset)
436 return NULL;
438 if (isl_basic_set_fast_is_empty(bset))
439 return isl_morph_empty(bset);
440 if (bset->n_eq == 0)
441 return isl_morph_identity(bset);
443 isl_assert(bset->ctx, bset->n_div == 0, return NULL);
445 n_eq = bset->n_eq;
446 nparam = isl_basic_set_dim(bset, isl_dim_param);
447 nvar = isl_basic_set_dim(bset, isl_dim_set);
449 isl_assert(bset->ctx, n_eq <= nvar, return NULL);
451 d = isl_vec_alloc(bset->ctx, n_eq);
452 B = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, n_eq, 0, 1 + nparam);
453 H = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, n_eq, 1 + nparam, nvar);
454 H = isl_mat_left_hermite(H, 0, NULL, NULL);
455 H = isl_mat_drop_cols(H, n_eq, nvar - n_eq);
456 H = isl_mat_lin_to_aff(H);
457 H = isl_mat_right_inverse(H);
458 if (!H || !d)
459 goto error;
460 isl_seq_set(d->el, H->row[0][0], d->size);
461 H = isl_mat_drop_rows(H, 0, 1);
462 H = isl_mat_drop_cols(H, 0, 1);
463 B = isl_mat_product(H, B);
464 inv = isl_mat_parameter_compression(B, d);
465 inv = isl_mat_diagonal(inv, isl_mat_identity(bset->ctx, nvar));
466 map = isl_mat_right_inverse(isl_mat_copy(inv));
468 dom = isl_basic_set_universe(isl_dim_copy(bset->dim));
469 ran = isl_basic_set_universe(isl_dim_copy(bset->dim));
471 return isl_morph_alloc(dom, ran, map, inv);
472 error:
473 isl_mat_free(H);
474 isl_mat_free(B);
475 isl_vec_free(d);
476 return NULL;
479 /* Add stride constraints to "bset" based on the inverse mapping
480 * that was plugged in. In particular, if morph maps x' to x,
481 * the the constraints of the original input
483 * A x' + b >= 0
485 * have been rewritten to
487 * A inv x + b >= 0
489 * However, this substitution may loose information on the integrality of x',
490 * so we need to impose that
492 * inv x
494 * is integral. If inv = B/d, this means that we need to impose that
496 * B x = 0 mod d
498 * or
500 * exists alpha in Z^m: B x = d alpha
503 static __isl_give isl_basic_set *add_strides(__isl_take isl_basic_set *bset,
504 __isl_keep isl_morph *morph)
506 int i, div, k;
507 isl_int gcd;
509 if (isl_int_is_one(morph->inv->row[0][0]))
510 return bset;
512 isl_int_init(gcd);
514 for (i = 0; 1 + i < morph->inv->n_row; ++i) {
515 isl_seq_gcd(morph->inv->row[1 + i], morph->inv->n_col, &gcd);
516 if (isl_int_is_divisible_by(gcd, morph->inv->row[0][0]))
517 continue;
518 div = isl_basic_set_alloc_div(bset);
519 if (div < 0)
520 goto error;
521 k = isl_basic_set_alloc_equality(bset);
522 if (k < 0)
523 goto error;
524 isl_seq_cpy(bset->eq[k], morph->inv->row[1 + i],
525 morph->inv->n_col);
526 isl_seq_clr(bset->eq[k] + morph->inv->n_col, bset->n_div);
527 isl_int_set(bset->eq[k][morph->inv->n_col + div],
528 morph->inv->row[0][0]);
531 isl_int_clear(gcd);
533 return bset;
534 error:
535 isl_int_clear(gcd);
536 isl_basic_set_free(bset);
537 return NULL;
540 /* Apply the morphism to the basic set.
541 * We basically just compute the preimage of "bset" under the inverse mapping
542 * in morph, add in stride constraints and intersect with the range
543 * of the morphism.
545 __isl_give isl_basic_set *isl_morph_basic_set(__isl_take isl_morph *morph,
546 __isl_take isl_basic_set *bset)
548 isl_basic_set *res = NULL;
549 isl_mat *mat = NULL;
550 int i, k;
551 int max_stride;
553 if (!morph || !bset)
554 goto error;
556 isl_assert(bset->ctx, isl_dim_equal(bset->dim, morph->dom->dim),
557 goto error);
559 max_stride = morph->inv->n_row - 1;
560 if (isl_int_is_one(morph->inv->row[0][0]))
561 max_stride = 0;
562 res = isl_basic_set_alloc_dim(isl_dim_copy(morph->ran->dim),
563 bset->n_div + max_stride, bset->n_eq + max_stride, bset->n_ineq);
565 for (i = 0; i < bset->n_div; ++i)
566 if (isl_basic_set_alloc_div(res) < 0)
567 goto error;
569 mat = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq,
570 0, morph->inv->n_row);
571 mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
572 if (!mat)
573 goto error;
574 for (i = 0; i < bset->n_eq; ++i) {
575 k = isl_basic_set_alloc_equality(res);
576 if (k < 0)
577 goto error;
578 isl_seq_cpy(res->eq[k], mat->row[i], mat->n_col);
579 isl_seq_scale(res->eq[k] + mat->n_col, bset->eq[i] + mat->n_col,
580 morph->inv->row[0][0], bset->n_div);
582 isl_mat_free(mat);
584 mat = isl_mat_sub_alloc(bset->ctx, bset->ineq, 0, bset->n_ineq,
585 0, morph->inv->n_row);
586 mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
587 if (!mat)
588 goto error;
589 for (i = 0; i < bset->n_ineq; ++i) {
590 k = isl_basic_set_alloc_inequality(res);
591 if (k < 0)
592 goto error;
593 isl_seq_cpy(res->ineq[k], mat->row[i], mat->n_col);
594 isl_seq_scale(res->ineq[k] + mat->n_col,
595 bset->ineq[i] + mat->n_col,
596 morph->inv->row[0][0], bset->n_div);
598 isl_mat_free(mat);
600 mat = isl_mat_sub_alloc(bset->ctx, bset->div, 0, bset->n_div,
601 1, morph->inv->n_row);
602 mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
603 if (!mat)
604 goto error;
605 for (i = 0; i < bset->n_div; ++i) {
606 isl_int_mul(res->div[i][0],
607 morph->inv->row[0][0], bset->div[i][0]);
608 isl_seq_cpy(res->div[i] + 1, mat->row[i], mat->n_col);
609 isl_seq_scale(res->div[i] + 1 + mat->n_col,
610 bset->div[i] + 1 + mat->n_col,
611 morph->inv->row[0][0], bset->n_div);
613 isl_mat_free(mat);
615 res = add_strides(res, morph);
617 res = isl_basic_set_simplify(res);
618 res = isl_basic_set_finalize(res);
620 res = isl_basic_set_intersect(res, isl_basic_set_copy(morph->ran));
622 isl_morph_free(morph);
623 isl_basic_set_free(bset);
624 return res;
625 error:
626 isl_mat_free(mat);
627 isl_morph_free(morph);
628 isl_basic_set_free(bset);
629 isl_basic_set_free(res);
630 return NULL;
633 /* Apply the morphism to the set.
635 __isl_give isl_set *isl_morph_set(__isl_take isl_morph *morph,
636 __isl_take isl_set *set)
638 int i;
640 if (!morph || !set)
641 goto error;
643 isl_assert(set->ctx, isl_dim_equal(set->dim, morph->dom->dim), goto error);
645 set = isl_set_cow(set);
646 if (!set)
647 goto error;
649 isl_dim_free(set->dim);
650 set->dim = isl_dim_copy(morph->ran->dim);
651 if (!set->dim)
652 goto error;
654 for (i = 0; i < set->n; ++i) {
655 set->p[i] = isl_morph_basic_set(isl_morph_copy(morph), set->p[i]);
656 if (!set->p[i])
657 goto error;
660 isl_morph_free(morph);
662 ISL_F_CLR(set, ISL_SET_NORMALIZED);
664 return set;
665 error:
666 isl_set_free(set);
667 isl_morph_free(morph);
668 return NULL;
671 /* Construct a morphism that first does morph2 and then morph1.
673 __isl_give isl_morph *isl_morph_compose(__isl_take isl_morph *morph1,
674 __isl_take isl_morph *morph2)
676 isl_mat *map, *inv;
677 isl_basic_set *dom, *ran;
679 if (!morph1 || !morph2)
680 goto error;
682 map = isl_mat_product(isl_mat_copy(morph1->map), isl_mat_copy(morph2->map));
683 inv = isl_mat_product(isl_mat_copy(morph2->inv), isl_mat_copy(morph1->inv));
684 dom = isl_morph_basic_set(isl_morph_inverse(isl_morph_copy(morph2)),
685 isl_basic_set_copy(morph1->dom));
686 dom = isl_basic_set_intersect(dom, isl_basic_set_copy(morph2->dom));
687 ran = isl_morph_basic_set(isl_morph_copy(morph1),
688 isl_basic_set_copy(morph2->ran));
689 ran = isl_basic_set_intersect(ran, isl_basic_set_copy(morph1->ran));
691 isl_morph_free(morph1);
692 isl_morph_free(morph2);
694 return isl_morph_alloc(dom, ran, map, inv);
695 error:
696 isl_morph_free(morph1);
697 isl_morph_free(morph2);
698 return NULL;
701 __isl_give isl_morph *isl_morph_inverse(__isl_take isl_morph *morph)
703 isl_basic_set *bset;
704 isl_mat *mat;
706 morph = isl_morph_cow(morph);
707 if (!morph)
708 return NULL;
710 bset = morph->dom;
711 morph->dom = morph->ran;
712 morph->ran = bset;
714 mat = morph->map;
715 morph->map = morph->inv;
716 morph->inv = mat;
718 return morph;
721 __isl_give isl_morph *isl_basic_set_full_compression(
722 __isl_keep isl_basic_set *bset)
724 isl_morph *morph, *morph2;
726 bset = isl_basic_set_copy(bset);
728 morph = isl_basic_set_variable_compression(bset, isl_dim_param);
729 bset = isl_morph_basic_set(isl_morph_copy(morph), bset);
731 morph2 = isl_basic_set_parameter_compression(bset);
732 bset = isl_morph_basic_set(isl_morph_copy(morph2), bset);
734 morph = isl_morph_compose(morph2, morph);
736 morph2 = isl_basic_set_variable_compression(bset, isl_dim_set);
737 isl_basic_set_free(bset);
739 morph = isl_morph_compose(morph2, morph);
741 return morph;