2 * Copyright 2010-2011 INRIA Saclay
3 * Copyright 2014 Ecole Normale Superieure
5 * Use of this software is governed by the MIT license
7 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
8 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
10 * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
13 #include <isl_map_private.h>
14 #include <isl_aff_private.h>
15 #include <isl_morph.h>
17 #include <isl_mat_private.h>
18 #include <isl_space_private.h>
19 #include <isl_equalities.h>
20 #include <isl_id_private.h>
22 isl_ctx
*isl_morph_get_ctx(__isl_keep isl_morph
*morph
)
26 return isl_basic_set_get_ctx(morph
->dom
);
29 __isl_give isl_morph
*isl_morph_alloc(
30 __isl_take isl_basic_set
*dom
, __isl_take isl_basic_set
*ran
,
31 __isl_take isl_mat
*map
, __isl_take isl_mat
*inv
)
35 if (!dom
|| !ran
|| !map
|| !inv
)
38 morph
= isl_alloc_type(dom
->ctx
, struct isl_morph
);
50 isl_basic_set_free(dom
);
51 isl_basic_set_free(ran
);
57 __isl_give isl_morph
*isl_morph_copy(__isl_keep isl_morph
*morph
)
66 __isl_give isl_morph
*isl_morph_dup(__isl_keep isl_morph
*morph
)
71 return isl_morph_alloc(isl_basic_set_copy(morph
->dom
),
72 isl_basic_set_copy(morph
->ran
),
73 isl_mat_copy(morph
->map
), isl_mat_copy(morph
->inv
));
76 __isl_give isl_morph
*isl_morph_cow(__isl_take isl_morph
*morph
)
84 return isl_morph_dup(morph
);
87 __isl_null isl_morph
*isl_morph_free(__isl_take isl_morph
*morph
)
95 isl_basic_set_free(morph
->dom
);
96 isl_basic_set_free(morph
->ran
);
97 isl_mat_free(morph
->map
);
98 isl_mat_free(morph
->inv
);
104 /* Is "morph" an identity on the parameters?
106 static isl_bool
identity_on_parameters(__isl_keep isl_morph
*morph
)
108 isl_bool is_identity
;
109 isl_size nparam
, nparam_ran
;
112 nparam
= isl_morph_dom_dim(morph
, isl_dim_param
);
113 nparam_ran
= isl_morph_ran_dim(morph
, isl_dim_param
);
114 if (nparam
< 0 || nparam_ran
< 0)
115 return isl_bool_error
;
116 if (nparam
!= nparam_ran
)
117 return isl_bool_false
;
119 return isl_bool_true
;
120 sub
= isl_mat_sub_alloc(morph
->map
, 0, 1 + nparam
, 0, 1 + nparam
);
121 is_identity
= isl_mat_is_scaled_identity(sub
);
127 /* Return an affine expression of the variables of the range of "morph"
128 * in terms of the parameters and the variables of the domain on "morph".
130 * In order for the space manipulations to make sense, we require
131 * that the parameters are not modified by "morph".
133 __isl_give isl_multi_aff
*isl_morph_get_var_multi_aff(
134 __isl_keep isl_morph
*morph
)
136 isl_space
*dom
, *ran
, *space
;
139 isl_size nparam
, nvar
;
141 isl_bool is_identity
;
146 is_identity
= identity_on_parameters(morph
);
150 isl_die(isl_morph_get_ctx(morph
), isl_error_invalid
,
151 "cannot handle parameter compression", return NULL
);
153 dom
= isl_morph_get_dom_space(morph
);
154 ls
= isl_local_space_from_space(isl_space_copy(dom
));
155 ran
= isl_morph_get_ran_space(morph
);
156 space
= isl_space_map_from_domain_and_range(dom
, ran
);
157 ma
= isl_multi_aff_zero(space
);
159 nparam
= isl_multi_aff_dim(ma
, isl_dim_param
);
160 nvar
= isl_multi_aff_dim(ma
, isl_dim_out
);
161 if (nparam
< 0 || nvar
< 0)
162 ma
= isl_multi_aff_free(ma
);
163 for (i
= 0; i
< nvar
; ++i
) {
168 v
= isl_mat_get_row(morph
->map
, 1 + nparam
+ i
);
169 v
= isl_vec_insert_els(v
, 0, 1);
170 val
= isl_mat_get_element_val(morph
->map
, 0, 0);
171 v
= isl_vec_set_element_val(v
, 0, val
);
172 aff
= isl_aff_alloc_vec(isl_local_space_copy(ls
), v
);
173 ma
= isl_multi_aff_set_aff(ma
, i
, aff
);
176 isl_local_space_free(ls
);
180 /* Return the domain space of "morph".
182 __isl_give isl_space
*isl_morph_get_dom_space(__isl_keep isl_morph
*morph
)
187 return isl_basic_set_get_space(morph
->dom
);
190 __isl_give isl_space
*isl_morph_get_ran_space(__isl_keep isl_morph
*morph
)
195 return isl_space_copy(morph
->ran
->dim
);
198 isl_size
isl_morph_dom_dim(__isl_keep isl_morph
*morph
, enum isl_dim_type type
)
201 return isl_size_error
;
203 return isl_basic_set_dim(morph
->dom
, type
);
206 isl_size
isl_morph_ran_dim(__isl_keep isl_morph
*morph
, enum isl_dim_type type
)
209 return isl_size_error
;
211 return isl_basic_set_dim(morph
->ran
, type
);
214 __isl_give isl_morph
*isl_morph_remove_dom_dims(__isl_take isl_morph
*morph
,
215 enum isl_dim_type type
, unsigned first
, unsigned n
)
222 morph
= isl_morph_cow(morph
);
226 dom_offset
= 1 + isl_space_offset(morph
->dom
->dim
, type
);
228 morph
->dom
= isl_basic_set_remove_dims(morph
->dom
, type
, first
, n
);
230 morph
->map
= isl_mat_drop_cols(morph
->map
, dom_offset
+ first
, n
);
232 morph
->inv
= isl_mat_drop_rows(morph
->inv
, dom_offset
+ first
, n
);
234 if (morph
->dom
&& morph
->ran
&& morph
->map
&& morph
->inv
)
237 isl_morph_free(morph
);
241 __isl_give isl_morph
*isl_morph_remove_ran_dims(__isl_take isl_morph
*morph
,
242 enum isl_dim_type type
, unsigned first
, unsigned n
)
249 morph
= isl_morph_cow(morph
);
253 ran_offset
= 1 + isl_space_offset(morph
->ran
->dim
, type
);
255 morph
->ran
= isl_basic_set_remove_dims(morph
->ran
, type
, first
, n
);
257 morph
->map
= isl_mat_drop_rows(morph
->map
, ran_offset
+ first
, n
);
259 morph
->inv
= isl_mat_drop_cols(morph
->inv
, ran_offset
+ first
, n
);
261 if (morph
->dom
&& morph
->ran
&& morph
->map
&& morph
->inv
)
264 isl_morph_free(morph
);
268 /* Project domain of morph onto its parameter domain.
270 __isl_give isl_morph
*isl_morph_dom_params(__isl_take isl_morph
*morph
)
274 morph
= isl_morph_cow(morph
);
277 n
= isl_basic_set_dim(morph
->dom
, isl_dim_set
);
279 return isl_morph_free(morph
);
280 morph
= isl_morph_remove_dom_dims(morph
, isl_dim_set
, 0, n
);
283 morph
->dom
= isl_basic_set_params(morph
->dom
);
287 isl_morph_free(morph
);
291 /* Project range of morph onto its parameter domain.
293 __isl_give isl_morph
*isl_morph_ran_params(__isl_take isl_morph
*morph
)
297 morph
= isl_morph_cow(morph
);
300 n
= isl_basic_set_dim(morph
->ran
, isl_dim_set
);
302 return isl_morph_free(morph
);
303 morph
= isl_morph_remove_ran_dims(morph
, isl_dim_set
, 0, n
);
306 morph
->ran
= isl_basic_set_params(morph
->ran
);
310 isl_morph_free(morph
);
314 void isl_morph_print_internal(__isl_take isl_morph
*morph
, FILE *out
)
319 isl_basic_set_dump(morph
->dom
);
320 isl_basic_set_dump(morph
->ran
);
321 isl_mat_print_internal(morph
->map
, out
, 4);
322 isl_mat_print_internal(morph
->inv
, out
, 4);
325 void isl_morph_dump(__isl_take isl_morph
*morph
)
327 isl_morph_print_internal(morph
, stderr
);
330 __isl_give isl_morph
*isl_morph_identity(__isl_keep isl_basic_set
*bset
)
333 isl_basic_set
*universe
;
336 total
= isl_basic_set_dim(bset
, isl_dim_all
);
340 id
= isl_mat_identity(bset
->ctx
, 1 + total
);
341 universe
= isl_basic_set_universe(isl_space_copy(bset
->dim
));
343 return isl_morph_alloc(universe
, isl_basic_set_copy(universe
),
344 id
, isl_mat_copy(id
));
347 /* Create a(n identity) morphism between empty sets of the same dimension
350 __isl_give isl_morph
*isl_morph_empty(__isl_keep isl_basic_set
*bset
)
353 isl_basic_set
*empty
;
356 total
= isl_basic_set_dim(bset
, isl_dim_all
);
360 id
= isl_mat_identity(bset
->ctx
, 1 + total
);
361 empty
= isl_basic_set_empty(isl_space_copy(bset
->dim
));
363 return isl_morph_alloc(empty
, isl_basic_set_copy(empty
),
364 id
, isl_mat_copy(id
));
367 /* Construct a basic set described by the "n" equalities of "bset" starting
370 static __isl_give isl_basic_set
*copy_equalities(__isl_keep isl_basic_set
*bset
,
371 unsigned first
, unsigned n
)
377 total
= isl_basic_set_dim(bset
, isl_dim_all
);
378 if (total
< 0 || isl_basic_set_check_no_locals(bset
) < 0)
381 eq
= isl_basic_set_alloc_space(isl_basic_set_get_space(bset
), 0, n
, 0);
384 for (i
= 0; i
< n
; ++i
) {
385 k
= isl_basic_set_alloc_equality(eq
);
388 isl_seq_cpy(eq
->eq
[k
], bset
->eq
[first
+ i
], 1 + total
);
393 isl_basic_set_free(eq
);
397 /* Given a basic set, exploit the equalities in the basic set to construct
398 * a morphism that maps the basic set to a lower-dimensional space
399 * with identifier "id".
400 * Specifically, the morphism reduces the number of dimensions of type "type".
402 * We first select the equalities of interest, that is those that involve
403 * variables of type "type" and no later variables.
404 * Denote those equalities as
408 * where C(p) depends on the parameters if type == isl_dim_set and
409 * is a constant if type == isl_dim_param.
411 * Use isl_mat_final_variable_compression to construct a compression
417 * If T is a zero-column matrix, then the set of equality constraints
418 * do not admit a solution. In this case, an empty morphism is returned.
420 * Both matrices are extended to map the full original space to the full
423 __isl_give isl_morph
*isl_basic_set_variable_compression_with_id(
424 __isl_keep isl_basic_set
*bset
, enum isl_dim_type type
,
425 __isl_keep isl_id
*id
)
435 isl_basic_set
*dom
, *ran
;
440 if (isl_basic_set_plain_is_empty(bset
))
441 return isl_morph_empty(bset
);
443 if (isl_basic_set_check_no_locals(bset
) < 0)
446 ntype
= isl_basic_set_dim(bset
, type
);
447 total
= isl_basic_set_dim(bset
, isl_dim_all
);
448 if (ntype
< 0 || total
< 0)
450 otype
= isl_basic_set_offset(bset
, type
);
451 orest
= otype
+ ntype
;
452 nrest
= total
- (orest
- 1);
454 for (f_eq
= 0; f_eq
< bset
->n_eq
; ++f_eq
)
455 if (isl_seq_first_non_zero(bset
->eq
[f_eq
] + orest
, nrest
) == -1)
457 for (n_eq
= 0; f_eq
+ n_eq
< bset
->n_eq
; ++n_eq
)
458 if (isl_seq_first_non_zero(bset
->eq
[f_eq
+ n_eq
] + otype
, ntype
) == -1)
461 return isl_morph_identity(bset
);
463 E
= isl_mat_sub_alloc6(bset
->ctx
, bset
->eq
, f_eq
, n_eq
, 0, orest
);
464 C
= isl_mat_final_variable_compression(E
, otype
- 1, &Q
);
467 if (C
&& C
->n_col
== 0) {
470 return isl_morph_empty(bset
);
473 Q
= isl_mat_diagonal(Q
, isl_mat_identity(bset
->ctx
, nrest
));
474 C
= isl_mat_diagonal(C
, isl_mat_identity(bset
->ctx
, nrest
));
476 space
= isl_space_copy(bset
->dim
);
477 space
= isl_space_drop_dims(space
, type
, 0, ntype
);
478 space
= isl_space_add_dims(space
, type
, ntype
- n_eq
);
479 space
= isl_space_set_tuple_id(space
, isl_dim_set
, isl_id_copy(id
));
480 ran
= isl_basic_set_universe(space
);
481 dom
= copy_equalities(bset
, f_eq
, n_eq
);
483 return isl_morph_alloc(dom
, ran
, Q
, C
);
486 /* Given a basic set, exploit the equalities in the basic set to construct
487 * a morphism that maps the basic set to a lower-dimensional space.
488 * Specifically, the morphism reduces the number of dimensions of type "type".
490 __isl_give isl_morph
*isl_basic_set_variable_compression(
491 __isl_keep isl_basic_set
*bset
, enum isl_dim_type type
)
493 return isl_basic_set_variable_compression_with_id(bset
, type
,
497 /* Construct a parameter compression for "bset".
498 * We basically just call isl_mat_parameter_compression with the right input
499 * and then extend the resulting matrix to include the variables.
501 * The implementation assumes that "bset" does not have any equalities
502 * that only involve the parameters and that isl_basic_set_gauss has
503 * been applied to "bset".
505 * Let the equalities be given as
509 * We use isl_mat_parameter_compression_ext to compute the compression
513 __isl_give isl_morph
*isl_basic_set_parameter_compression(
514 __isl_keep isl_basic_set
*bset
)
522 isl_basic_set
*dom
, *ran
;
527 if (isl_basic_set_plain_is_empty(bset
))
528 return isl_morph_empty(bset
);
530 return isl_morph_identity(bset
);
533 nparam
= isl_basic_set_dim(bset
, isl_dim_param
);
534 nvar
= isl_basic_set_dim(bset
, isl_dim_set
);
535 n_div
= isl_basic_set_dim(bset
, isl_dim_div
);
536 if (nparam
< 0 || nvar
< 0 || n_div
< 0)
539 if (isl_seq_first_non_zero(bset
->eq
[bset
->n_eq
- 1] + 1 + nparam
,
541 isl_die(isl_basic_set_get_ctx(bset
), isl_error_invalid
,
542 "input not allowed to have parameter equalities",
544 if (n_eq
> nvar
+ n_div
)
545 isl_die(isl_basic_set_get_ctx(bset
), isl_error_invalid
,
546 "input not gaussed", return NULL
);
548 B
= isl_mat_sub_alloc6(bset
->ctx
, bset
->eq
, 0, n_eq
, 0, 1 + nparam
);
549 H
= isl_mat_sub_alloc6(bset
->ctx
, bset
->eq
,
550 0, n_eq
, 1 + nparam
, nvar
+ n_div
);
551 inv
= isl_mat_parameter_compression_ext(B
, H
);
552 inv
= isl_mat_diagonal(inv
, isl_mat_identity(bset
->ctx
, nvar
));
553 map
= isl_mat_right_inverse(isl_mat_copy(inv
));
555 dom
= isl_basic_set_universe(isl_space_copy(bset
->dim
));
556 ran
= isl_basic_set_universe(isl_space_copy(bset
->dim
));
558 return isl_morph_alloc(dom
, ran
, map
, inv
);
561 /* Add stride constraints to "bset" based on the inverse mapping
562 * that was plugged in. In particular, if morph maps x' to x,
563 * the constraints of the original input
567 * have been rewritten to
571 * However, this substitution may loose information on the integrality of x',
572 * so we need to impose that
576 * is integral. If inv = B/d, this means that we need to impose that
582 * exists alpha in Z^m: B x = d alpha
584 * This function is similar to add_strides in isl_affine_hull.c
586 static __isl_give isl_basic_set
*add_strides(__isl_take isl_basic_set
*bset
,
587 __isl_keep isl_morph
*morph
)
592 if (isl_int_is_one(morph
->inv
->row
[0][0]))
597 for (i
= 0; 1 + i
< morph
->inv
->n_row
; ++i
) {
598 isl_seq_gcd(morph
->inv
->row
[1 + i
], morph
->inv
->n_col
, &gcd
);
599 if (isl_int_is_divisible_by(gcd
, morph
->inv
->row
[0][0]))
601 div
= isl_basic_set_alloc_div(bset
);
604 isl_int_set_si(bset
->div
[div
][0], 0);
605 k
= isl_basic_set_alloc_equality(bset
);
608 isl_seq_cpy(bset
->eq
[k
], morph
->inv
->row
[1 + i
],
610 isl_seq_clr(bset
->eq
[k
] + morph
->inv
->n_col
, bset
->n_div
);
611 isl_int_set(bset
->eq
[k
][morph
->inv
->n_col
+ div
],
612 morph
->inv
->row
[0][0]);
620 isl_basic_set_free(bset
);
624 /* Apply the morphism to the basic set.
625 * We basically just compute the preimage of "bset" under the inverse mapping
626 * in morph, add in stride constraints and intersect with the range
629 __isl_give isl_basic_set
*isl_morph_basic_set(__isl_take isl_morph
*morph
,
630 __isl_take isl_basic_set
*bset
)
632 isl_basic_set
*res
= NULL
;
640 isl_assert(bset
->ctx
, isl_space_is_equal(bset
->dim
, morph
->dom
->dim
),
643 max_stride
= morph
->inv
->n_row
- 1;
644 if (isl_int_is_one(morph
->inv
->row
[0][0]))
646 res
= isl_basic_set_alloc_space(isl_space_copy(morph
->ran
->dim
),
647 bset
->n_div
+ max_stride
, bset
->n_eq
+ max_stride
, bset
->n_ineq
);
649 for (i
= 0; i
< bset
->n_div
; ++i
)
650 if (isl_basic_set_alloc_div(res
) < 0)
653 mat
= isl_mat_sub_alloc6(bset
->ctx
, bset
->eq
, 0, bset
->n_eq
,
654 0, morph
->inv
->n_row
);
655 mat
= isl_mat_product(mat
, isl_mat_copy(morph
->inv
));
658 for (i
= 0; i
< bset
->n_eq
; ++i
) {
659 k
= isl_basic_set_alloc_equality(res
);
662 isl_seq_cpy(res
->eq
[k
], mat
->row
[i
], mat
->n_col
);
663 isl_seq_scale(res
->eq
[k
] + mat
->n_col
, bset
->eq
[i
] + mat
->n_col
,
664 morph
->inv
->row
[0][0], bset
->n_div
);
668 mat
= isl_mat_sub_alloc6(bset
->ctx
, bset
->ineq
, 0, bset
->n_ineq
,
669 0, morph
->inv
->n_row
);
670 mat
= isl_mat_product(mat
, isl_mat_copy(morph
->inv
));
673 for (i
= 0; i
< bset
->n_ineq
; ++i
) {
674 k
= isl_basic_set_alloc_inequality(res
);
677 isl_seq_cpy(res
->ineq
[k
], mat
->row
[i
], mat
->n_col
);
678 isl_seq_scale(res
->ineq
[k
] + mat
->n_col
,
679 bset
->ineq
[i
] + mat
->n_col
,
680 morph
->inv
->row
[0][0], bset
->n_div
);
684 mat
= isl_mat_sub_alloc6(bset
->ctx
, bset
->div
, 0, bset
->n_div
,
685 1, morph
->inv
->n_row
);
686 mat
= isl_mat_product(mat
, isl_mat_copy(morph
->inv
));
689 for (i
= 0; i
< bset
->n_div
; ++i
) {
690 isl_int_mul(res
->div
[i
][0],
691 morph
->inv
->row
[0][0], bset
->div
[i
][0]);
692 isl_seq_cpy(res
->div
[i
] + 1, mat
->row
[i
], mat
->n_col
);
693 isl_seq_scale(res
->div
[i
] + 1 + mat
->n_col
,
694 bset
->div
[i
] + 1 + mat
->n_col
,
695 morph
->inv
->row
[0][0], bset
->n_div
);
699 res
= add_strides(res
, morph
);
701 if (isl_basic_set_is_rational(bset
))
702 res
= isl_basic_set_set_rational(res
);
704 res
= isl_basic_set_simplify(res
);
705 res
= isl_basic_set_finalize(res
);
707 res
= isl_basic_set_intersect(res
, isl_basic_set_copy(morph
->ran
));
709 isl_morph_free(morph
);
710 isl_basic_set_free(bset
);
714 isl_morph_free(morph
);
715 isl_basic_set_free(bset
);
716 isl_basic_set_free(res
);
720 /* Apply the morphism to the set.
722 __isl_give isl_set
*isl_morph_set(__isl_take isl_morph
*morph
,
723 __isl_take isl_set
*set
)
730 isl_assert(set
->ctx
, isl_space_is_equal(set
->dim
, morph
->dom
->dim
), goto error
);
732 set
= isl_set_cow(set
);
736 isl_space_free(set
->dim
);
737 set
->dim
= isl_space_copy(morph
->ran
->dim
);
741 for (i
= 0; i
< set
->n
; ++i
) {
742 set
->p
[i
] = isl_morph_basic_set(isl_morph_copy(morph
), set
->p
[i
]);
747 isl_morph_free(morph
);
749 ISL_F_CLR(set
, ISL_SET_NORMALIZED
);
754 isl_morph_free(morph
);
758 /* Construct a morphism that first does morph2 and then morph1.
760 __isl_give isl_morph
*isl_morph_compose(__isl_take isl_morph
*morph1
,
761 __isl_take isl_morph
*morph2
)
764 isl_basic_set
*dom
, *ran
;
766 if (!morph1
|| !morph2
)
769 map
= isl_mat_product(isl_mat_copy(morph1
->map
), isl_mat_copy(morph2
->map
));
770 inv
= isl_mat_product(isl_mat_copy(morph2
->inv
), isl_mat_copy(morph1
->inv
));
771 dom
= isl_morph_basic_set(isl_morph_inverse(isl_morph_copy(morph2
)),
772 isl_basic_set_copy(morph1
->dom
));
773 dom
= isl_basic_set_intersect(dom
, isl_basic_set_copy(morph2
->dom
));
774 ran
= isl_morph_basic_set(isl_morph_copy(morph1
),
775 isl_basic_set_copy(morph2
->ran
));
776 ran
= isl_basic_set_intersect(ran
, isl_basic_set_copy(morph1
->ran
));
778 isl_morph_free(morph1
);
779 isl_morph_free(morph2
);
781 return isl_morph_alloc(dom
, ran
, map
, inv
);
783 isl_morph_free(morph1
);
784 isl_morph_free(morph2
);
788 __isl_give isl_morph
*isl_morph_inverse(__isl_take isl_morph
*morph
)
793 morph
= isl_morph_cow(morph
);
798 morph
->dom
= morph
->ran
;
802 morph
->map
= morph
->inv
;
808 /* We detect all the equalities first to avoid implicit equalities
809 * being discovered during the computations. In particular,
810 * the compression on the variables could expose additional stride
811 * constraints on the parameters. This would result in existentially
812 * quantified variables after applying the resulting morph, which
813 * in turn could break invariants of the calling functions.
815 __isl_give isl_morph
*isl_basic_set_full_compression(
816 __isl_keep isl_basic_set
*bset
)
818 isl_morph
*morph
, *morph2
;
820 bset
= isl_basic_set_copy(bset
);
821 bset
= isl_basic_set_detect_equalities(bset
);
823 morph
= isl_basic_set_variable_compression(bset
, isl_dim_param
);
824 bset
= isl_morph_basic_set(isl_morph_copy(morph
), bset
);
826 morph2
= isl_basic_set_parameter_compression(bset
);
827 bset
= isl_morph_basic_set(isl_morph_copy(morph2
), bset
);
829 morph
= isl_morph_compose(morph2
, morph
);
831 morph2
= isl_basic_set_variable_compression(bset
, isl_dim_set
);
832 isl_basic_set_free(bset
);
834 morph
= isl_morph_compose(morph2
, morph
);
839 __isl_give isl_vec
*isl_morph_vec(__isl_take isl_morph
*morph
,
840 __isl_take isl_vec
*vec
)
845 vec
= isl_mat_vec_product(isl_mat_copy(morph
->map
), vec
);
847 isl_morph_free(morph
);
850 isl_morph_free(morph
);