Lines Matching defs:umap
44 /* Return the number of parameters of "umap", where "type"
47 isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
50 if (!umap)
54 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
57 return isl_space_dim(umap->dim, type);
71 __isl_give isl_id *isl_union_map_get_dim_id(__isl_keep isl_union_map *umap,
74 if (!umap)
78 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
81 return isl_space_get_dim_id(umap->dim, type, pos);
106 isl_bool isl_union_map_is_params(__isl_keep isl_union_map *umap)
108 return isl_union_set_is_params(uset_from_umap(umap));
114 isl_union_map *umap;
120 umap = isl_calloc_type(space->ctx, isl_union_map);
121 if (!umap) {
126 umap->ref = 1;
127 umap->dim = space;
128 if (isl_hash_table_init(space->ctx, &umap->table, size) < 0)
129 return isl_union_map_free(umap);
131 return umap;
172 isl_ctx *isl_union_map_get_ctx(__isl_keep isl_union_map *umap)
174 return umap ? umap->dim->ctx : NULL;
182 /* Return the space of "umap".
184 __isl_keep isl_space *isl_union_map_peek_space(__isl_keep isl_union_map *umap)
186 return umap ? umap->dim : NULL;
196 __isl_give isl_space *isl_union_map_get_space(__isl_keep isl_union_map *umap)
198 return isl_space_copy(isl_union_map_peek_space(umap));
202 * in "umap".
205 int isl_union_map_find_dim_by_name(__isl_keep isl_union_map *umap,
208 if (!umap)
210 return isl_space_find_dim_by_name(umap->dim, type, name);
213 /* Return the position of the parameter with id "id" in "umap".
216 static int isl_union_map_find_dim_by_id(__isl_keep isl_union_map *umap,
221 space = isl_union_map_peek_space(umap);
239 isl_union_map **umap = (isl_union_map **)user;
241 *umap = isl_union_map_add_map(*umap, map);
246 __isl_give isl_union_map *isl_union_map_dup(__isl_keep isl_union_map *umap)
250 if (!umap)
253 dup = isl_union_map_empty(isl_space_copy(umap->dim));
254 if (isl_union_map_foreach_map(umap, &add_map, &dup) < 0)
262 __isl_give isl_union_map *isl_union_map_cow(__isl_take isl_union_map *umap)
264 if (!umap)
267 if (umap->ref == 1)
268 return umap;
269 umap->ref--;
270 return isl_union_map_dup(umap);
293 /* Align the parameters of umap along those of model.
296 * umap that do not appear in model.
299 __isl_take isl_union_map *umap, __isl_take isl_space *model)
305 space = isl_union_map_peek_space(umap);
311 return umap;
319 umap->table.n);
320 if (isl_hash_table_foreach(isl_union_map_get_ctx(umap), &umap->table,
325 isl_union_map_free(umap);
330 isl_union_map_free(umap);
346 * that are not involved in the description of "umap".
351 __isl_take isl_union_map *umap,
354 return isl_union_map_project_out(umap, type, first, n);
367 isl_union_map *umap;
369 umap = isl_union_map_drop_unused_params(uset_to_umap(uset));
370 return uset_from_umap(umap);
402 __isl_give isl_union_map *isl_union_map_copy(__isl_keep isl_union_map *umap)
404 if (!umap)
407 umap->ref++;
408 return umap;
416 __isl_null isl_union_map *isl_union_map_free(__isl_take isl_union_map *umap)
418 if (!umap)
421 if (--umap->ref > 0)
424 isl_hash_table_foreach(umap->dim->ctx, &umap->table,
426 isl_hash_table_clear(&umap->table);
427 isl_space_free(umap->dim);
428 free(umap);
437 /* Do "umap" and "space" have the same parameters?
439 isl_bool isl_union_map_space_has_equal_params(__isl_keep isl_union_map *umap,
444 umap_space = isl_union_map_peek_space(umap);
466 /* Find the entry in "umap" with space "space" (ignoring parameters),
467 * returning isl_hash_table_entry_none if no such entry appears in "umap" and
471 * this means "umap" must have a single reference when "reserve" is set.
474 __isl_keep isl_union_map *umap, __isl_keep isl_space *space,
479 if (!umap || !space)
481 if (reserve && isl_union_map_check_single_reference(umap) < 0)
485 return isl_hash_table_find(isl_union_map_get_ctx(umap), &umap->table,
502 __isl_give isl_union_map *isl_union_map_add_map(__isl_take isl_union_map *umap,
509 if (!map || !umap)
514 return umap;
517 aligned = isl_map_space_has_equal_params(map, umap->dim);
521 umap = isl_union_map_align_params(umap, isl_map_get_space(map));
522 map = isl_map_align_params(map, isl_union_map_get_space(umap));
525 umap = isl_union_map_cow(umap);
528 entry = isl_union_map_find_entry(umap, space, 1);
541 return umap;
544 isl_union_map_free(umap);
557 isl_union_map *umap;
564 umap = isl_union_map_empty(space);
565 umap = isl_union_map_add_map(umap, map);
567 return umap;
618 isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap)
620 return umap ? umap->table.n : isl_size_error;
628 isl_stat isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
633 if (!umap)
636 return isl_hash_table_foreach(umap->dim->ctx, &umap->table,
672 /* Does "test" succeed on every map in "umap"?
674 isl_bool isl_union_map_every_map(__isl_keep isl_union_map *umap,
680 if (!umap)
683 r = isl_hash_table_foreach(isl_union_map_get_ctx(umap), &umap->table,
705 /* Return the maps in "umap" as a list.
711 __isl_keep isl_union_map *umap)
717 n_maps = isl_union_map_n_map(umap);
720 ctx = isl_union_map_get_ctx(umap);
723 if (isl_union_map_foreach_map(umap, &add_list_map, &list) < 0)
738 /* Can "umap" be converted to an isl_map?
741 isl_bool isl_union_map_isa_map(__isl_keep isl_union_map *umap)
745 n = isl_union_map_n_map(umap);
769 __isl_give isl_map *isl_map_from_union_map(__isl_take isl_union_map *umap)
775 is_map = isl_union_map_isa_map(umap);
778 ctx = isl_union_map_get_ctx(umap);
784 isl_hash_table_foreach(ctx, &umap->table, ©_map, &map);
786 isl_union_map_free(umap);
790 isl_union_map_free(umap);
797 __isl_give isl_map *isl_union_map_as_map(__isl_take isl_union_map *umap)
799 return isl_map_from_union_map(umap);
815 /* Extract the map in "umap" that lives in the given space (ignoring
818 __isl_give isl_map *isl_union_map_extract_map(__isl_keep isl_union_map *umap,
823 entry = isl_union_map_find_entry(umap, space, 0);
841 /* Check if umap contains a map in the given space (ignoring parameters).
843 isl_bool isl_union_map_contains(__isl_keep isl_union_map *umap,
849 space = isl_space_align_params(space, isl_union_map_get_space(umap));
850 entry = isl_union_map_find_entry(umap, space, 0);
1139 static __isl_give isl_union_map *gen_bin_set_op(__isl_take isl_union_map *umap,
1144 umap = isl_union_map_align_params(umap, isl_set_get_space(set));
1145 set = isl_set_align_params(set, isl_union_map_get_space(umap));
1147 if (!umap || !set)
1151 data.res = isl_union_map_alloc(isl_space_copy(umap->dim),
1152 umap->table.n);
1153 if (isl_hash_table_foreach(umap->dim->ctx, &umap->table,
1157 isl_union_map_free(umap);
1161 isl_union_map_free(umap);
1167 /* Intersect "umap" with the parameter domain "set".
1172 __isl_take isl_union_map *umap, __isl_take isl_set *set)
1181 return umap;
1184 return gen_bin_set_op(umap, set, &intersect_params_entry);
1186 isl_union_map_free(umap);
1198 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1200 return isl_union_map_intersect_params(umap,
1205 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1207 return isl_union_map_gist_params(umap, isl_set_from_union_set(uset));
1330 __isl_take isl_union_map *umap, __isl_take isl_set *set)
1332 return gen_bin_set_op(umap, set, &gist_params_entry);
1341 __isl_give isl_union_map *isl_union_map_gist(__isl_take isl_union_map *umap,
1344 return match_bin_op(umap, context, &isl_map_gist);
1355 /* For each map in "umap", remove the constraints in the corresponding map
1361 __isl_take isl_union_map *umap, __isl_take isl_union_map *context)
1363 return match_bin_op(umap, context, &isl_map_plain_gist);
1425 /* Intersect the domain of "umap" with "uset".
1428 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1435 return gen_bin_op(umap, uset, &control);
1438 /* Intersect the domain of "umap" with "uset".
1440 * domain of "umap" with this set.
1443 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1446 return union_map_intersect_params(umap, uset);
1448 return union_map_intersect_domain(umap, uset);
1454 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1456 return isl_union_map_intersect_domain_union_set(umap, uset);
1459 /* Remove the elements of "uset" from the domain of "umap".
1462 __isl_take isl_union_map *umap, __isl_take isl_union_set *dom)
1470 return gen_bin_op(umap, dom, &control);
1473 /* Remove the elements of "uset" from the range of "umap".
1476 __isl_take isl_union_map *umap, __isl_take isl_union_set *dom)
1484 return gen_bin_op(umap, dom, &control);
1487 /* Compute the gist of "umap" with respect to the domain "uset".
1490 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1497 return gen_bin_op(umap, uset, &control);
1500 /* Compute the gist of "umap" with respect to the domain "uset".
1505 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1508 return union_map_gist_params(umap, uset);
1510 return union_map_gist_domain(umap, uset);
1513 /* Compute the gist of "umap" with respect to the range "uset".
1516 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1523 return gen_bin_op(umap, uset, &control);
1527 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1534 return gen_bin_op(umap, uset, &control);
1540 __isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
1542 return isl_union_map_intersect_range_union_set(umap, uset);
1545 /* Intersect each map in "umap" in a space [A -> B] -> C
1550 __isl_take isl_union_map *umap, __isl_take isl_union_map *factor)
1558 return gen_bin_op(umap, factor, &control);
1561 /* Intersect each map in "umap" in a space [A -> B] -> C
1566 __isl_take isl_union_map *umap, __isl_take isl_union_map *factor)
1574 return gen_bin_op(umap, factor, &control);
1577 /* Intersect each map in "umap" in a space A -> [B -> C]
1582 __isl_take isl_union_map *umap, __isl_take isl_union_map *factor)
1590 return gen_bin_op(umap, factor, &control);
1593 /* Intersect each map in "umap" in a space A -> [B -> C]
1598 __isl_take isl_union_map *umap, __isl_take isl_union_map *factor)
1606 return gen_bin_op(umap, factor, &control);
1688 /* Intersect each map in "umap" in a space [A -> B] -> C
1694 __isl_take isl_union_map *umap, __isl_take isl_union_set *domain)
1702 return gen_bin_op(umap, domain, &control);
1705 /* Intersect each map in "umap" in a space A -> [B -> C]
1711 __isl_take isl_union_map *umap, __isl_take isl_union_set *domain)
1719 return gen_bin_op(umap, domain, &control);
1737 __isl_take isl_union_set *uset, __isl_take isl_union_map *umap)
1739 return isl_union_map_apply_range(uset, umap);
2041 /* Modify the maps in "umap" based on "control".
2042 * If control->inplace is set, then modify the maps in "umap" in-place.
2045 * if "umap" is only referenced once. Otherwise, create a new union map
2048 static __isl_give isl_union_map *un_op(__isl_take isl_union_map *umap,
2053 if (!umap)
2056 isl_die(isl_union_map_get_ctx(umap), isl_error_internal,
2058 return isl_union_map_free(umap));
2060 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
2062 return isl_union_map_free(umap));
2064 if (control->total && umap->ref == 1)
2067 data.res = umap;
2071 space = isl_union_map_get_space(umap);
2072 data.res = isl_union_map_alloc(space, umap->table.n);
2074 if (isl_hash_table_foreach(isl_union_map_get_ctx(umap),
2075 &umap->table, &un_entry, &data) < 0)
2080 isl_union_map_free(umap);
2106 /* Modify the maps in "umap" by applying "fn" on them.
2107 * "fn" should apply to all maps in "umap" and should not modify the space.
2109 static __isl_give isl_union_map *total(__isl_take isl_union_map *umap,
2117 return un_op(umap, &control);
2128 __isl_take isl_union_map *umap)
2130 return total(umap, &isl_map_affine_hull_map);
2169 __isl_take isl_union_map *umap)
2171 return total(umap, &isl_map_polyhedral_hull_map);
2190 __isl_take isl_union_map *umap)
2192 return total(umap, &isl_map_simple_hull_map);
2201 static __isl_give isl_union_map *inplace(__isl_take isl_union_map *umap,
2209 return un_op(umap, &control);
2212 /* Remove redundant constraints in each of the basic maps of "umap".
2217 __isl_take isl_union_map *umap)
2219 return inplace(umap, &isl_map_remove_redundancies);
2231 __isl_take isl_union_map *umap)
2233 return inplace(umap, &isl_map_coalesce);
2243 __isl_take isl_union_map *umap)
2245 return inplace(umap, &isl_map_detect_equalities);
2255 __isl_take isl_union_map *umap)
2257 return inplace(umap, &isl_map_compute_divs);
2267 __isl_take isl_union_map *umap)
2269 return total(umap, &isl_map_lexmin);
2279 __isl_take isl_union_map *umap)
2281 return total(umap, &isl_map_lexmax);
2301 __isl_give isl_union_map *isl_union_map_universe(__isl_take isl_union_map *umap)
2306 return un_op(umap, &control);
2314 __isl_give isl_union_map *isl_union_map_reverse(__isl_take isl_union_map *umap)
2319 return un_op(umap, &control);
2326 __isl_take isl_union_map *umap)
2334 return un_op(umap, &control);
2341 __isl_take isl_union_map *umap)
2349 return un_op(umap, &control);
2354 __isl_give isl_set *isl_union_map_params(__isl_take isl_union_map *umap)
2361 empty = isl_union_map_is_empty(umap);
2366 space = isl_union_map_get_space(umap);
2367 isl_union_map_free(umap);
2370 return isl_set_from_union_set(un_op(umap, &control));
2372 isl_union_map_free(umap);
2383 __isl_give isl_union_set *isl_union_map_domain(__isl_take isl_union_map *umap)
2388 return un_op(umap, &control);
2391 __isl_give isl_union_set *isl_union_map_range(__isl_take isl_union_map *umap)
2396 return un_op(umap, &control);
2400 __isl_take isl_union_map *umap)
2405 return un_op(umap, &control);
2425 /* Return an isl_union_pw_multi_aff that maps a wrapped copy of "umap"
2429 __isl_take isl_union_map *umap)
2433 res = isl_union_pw_multi_aff_empty(isl_union_map_get_space(umap));
2434 if (isl_union_map_foreach_map(umap, &domain_map_upma, &res) < 0)
2437 isl_union_map_free(umap);
2442 __isl_take isl_union_map *umap)
2447 return un_op(umap, &control);
2472 __isl_give isl_union_set *isl_union_map_deltas(__isl_take isl_union_map *umap)
2478 return un_op(umap, &control);
2482 __isl_take isl_union_map *umap)
2488 return un_op(umap, &control);
2531 /* For each map in "umap" of the form [A -> B] -> C,
2535 __isl_take isl_union_map *umap)
2543 return un_op(umap, &control);
2546 /* For each map in "umap" of the form [A -> B] -> C,
2550 __isl_take isl_union_map *umap)
2558 return un_op(umap, &control);
2561 /* For each map in "umap" of the form A -> [B -> C],
2565 __isl_take isl_union_map *umap)
2573 return un_op(umap, &control);
2576 /* For each map in "umap" of the form A -> [B -> C],
2580 __isl_take isl_union_map *umap)
2588 return un_op(umap, &control);
2591 /* For each map in "umap" of the form [A -> B] -> [C -> D],
2595 __isl_take isl_union_map *umap)
2603 return un_op(umap, &control);
2606 /* For each map in "umap" of the form [A -> B] -> [C -> D],
2610 __isl_take isl_union_map *umap)
2618 return un_op(umap, &control);
2632 __isl_give isl_union_set *isl_union_map_wrap(__isl_take isl_union_map *umap)
2637 return un_op(umap, &control);
2824 __isl_give isl_basic_map *isl_union_map_sample(__isl_take isl_union_map *umap)
2828 if (!umap)
2831 if (isl_hash_table_foreach(umap->dim->ctx, &umap->table,
2837 sample = isl_basic_map_empty(isl_union_map_get_space(umap));
2839 isl_union_map_free(umap);
2843 isl_union_map_free(umap);
2880 static isl_bool union_map_forall(__isl_keep isl_union_map *umap,
2885 if (!umap)
2888 if (isl_hash_table_foreach(umap->dim->ctx, &umap->table,
2916 /* Check if fn(map, user) returns true for all maps "map" in umap.
2918 static isl_bool union_map_forall_user(__isl_keep isl_union_map *umap,
2923 if (!umap)
2926 if (isl_hash_table_foreach(umap->dim->ctx, &umap->table,
2933 /* Is "umap" obviously empty?
2935 isl_bool isl_union_map_plain_is_empty(__isl_keep isl_union_map *umap)
2939 n = isl_union_map_n_map(umap);
2945 isl_bool isl_union_map_is_empty(__isl_keep isl_union_map *umap)
2947 return union_map_forall(umap, &isl_map_is_empty);
2981 static isl_bool single_map_is_single_valued(__isl_keep isl_union_map *umap)
2986 umap = isl_union_map_copy(umap);
2987 map = isl_map_from_union_map(umap);
2996 * "umap" is the union map to be tested.
2997 * "sv" is set to 1 as long as "umap" may still be single-valued.
3000 isl_union_map *umap;
3004 /* Check if the data->umap is single-valued on "set".
3006 * If data->umap consists of a single map on "set", then test it
3016 * Terminate as soon as data->umap has been determined not to
3022 isl_union_map *umap, *test;
3025 umap = isl_union_map_copy(data->umap);
3026 umap = isl_union_map_intersect_domain(umap,
3029 n = isl_union_map_n_map(umap);
3033 data->sv = single_map_is_single_valued(umap);
3034 isl_union_map_free(umap);
3036 test = isl_union_map_reverse(isl_union_map_copy(umap));
3037 test = isl_union_map_apply_range(test, umap);
3055 isl_bool isl_union_map_is_single_valued(__isl_keep isl_union_map *umap)
3062 n = isl_union_map_n_map(umap);
3066 return single_map_is_single_valued(umap);
3068 universe = isl_union_map_universe(isl_union_map_copy(umap));
3072 data.umap = umap;
3081 isl_bool isl_union_map_is_injective(__isl_keep isl_union_map *umap)
3085 umap = isl_union_map_copy(umap);
3086 umap = isl_union_map_reverse(umap);
3087 in = isl_union_map_is_single_valued(umap);
3088 isl_union_map_free(umap);
3123 /* Is "umap" obviously not an identity relation because
3130 __isl_keep isl_union_map *umap)
3135 if (isl_union_map_foreach_map(umap, &map_plain_is_not_identity,
3162 /* Does "umap" only map elements to themselves?
3168 isl_bool isl_union_map_is_identity(__isl_keep isl_union_map *umap)
3173 non_identity = isl_union_map_plain_is_not_identity(umap);
3178 if (isl_union_map_foreach_map(umap, &map_is_identity, &identity) < 0 &&
3252 static isl_bool plain_injective_on_range(__isl_take isl_union_map *umap,
3310 /* Check whether the maps in umap have obviously distinct ranges.
3316 static isl_bool plain_injective_on_range(__isl_take isl_union_map *umap,
3323 ctx = isl_union_map_get_ctx(umap);
3325 n = isl_union_map_n_map(umap);
3330 isl_union_map_free(umap);
3335 isl_union_map_free(umap);
3349 fixed = union_map_forall_user(umap, &fixed_at_pos, &data);
3354 space = isl_union_map_get_space(umap);
3356 isl_union_map_free(umap);
3361 isl_union_map_free(umap);
3366 isl_union_map_free(umap);
3370 /* Check whether the maps in umap that map to subsets of "ran"
3377 isl_union_map *umap = user;
3383 umap = isl_union_map_copy(umap);
3384 umap = isl_union_map_intersect_range(umap,
3386 return plain_injective_on_range(umap, 0, dim);
3395 isl_bool isl_union_map_plain_is_injective(__isl_keep isl_union_map *umap)
3401 in = union_map_forall(umap, &isl_map_plain_is_injective);
3407 univ = isl_union_map_universe(isl_union_map_copy(umap));
3410 in = union_map_forall_user(ran, &plain_injective_on_range_wrap, umap);
3417 isl_bool isl_union_map_is_bijective(__isl_keep isl_union_map *umap)
3421 sv = isl_union_map_is_single_valued(umap);
3425 return isl_union_map_is_injective(umap);
3428 __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap)
3436 return un_op(umap, &control);
3442 __isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap)
3450 return un_op(umap, &control);
3456 __isl_give isl_union_map *isl_union_map_curry(__isl_take isl_union_map *umap)
3464 return un_op(umap, &control);
3471 __isl_take isl_union_map *umap)
3479 return un_op(umap, &control);
3644 /* Compute the preimage of the domain or range of "umap" under the function
3646 * In other words, plug in "pma" in the domain or range of "umap".
3651 __isl_take isl_union_map *umap, __isl_take isl_pw_multi_aff *pma,
3660 umap = isl_union_map_align_params(umap,
3662 pma = isl_pw_multi_aff_align_params(pma, isl_union_map_get_space(umap));
3664 if (!umap || !pma)
3667 ctx = isl_union_map_get_ctx(umap);
3668 space = isl_union_map_get_space(umap);
3671 data.res = isl_union_map_alloc(space, umap->table.n);
3674 if (isl_hash_table_foreach(ctx, &umap->table, &preimage_entry,
3679 isl_union_map_free(umap);
3683 isl_union_map_free(umap);
3688 /* Compute the preimage of the domain of "umap" under the function
3690 * In other words, plug in "pma" in the domain of "umap".
3691 * The result contains maps that live in the same spaces as the maps of "umap"
3696 __isl_take isl_union_map *umap, __isl_take isl_pw_multi_aff *pma)
3698 return preimage_pw_multi_aff(umap, pma, &domain_match,
3702 /* Compute the preimage of the range of "umap" under the function
3704 * In other words, plug in "pma" in the range of "umap".
3705 * The result contains maps that live in the same spaces as the maps of "umap"
3710 __isl_take isl_union_map *umap, __isl_take isl_pw_multi_aff *pma)
3712 return preimage_pw_multi_aff(umap, pma, &range_match,
3729 /* Compute the preimage of the domain of "umap" under the function
3731 * In other words, plug in "ma" in the domain of "umap".
3732 * The result contains maps that live in the same spaces as the maps of "umap"
3737 __isl_take isl_union_map *umap, __isl_take isl_multi_aff *ma)
3739 return isl_union_map_preimage_domain_pw_multi_aff(umap,
3743 /* Compute the preimage of the range of "umap" under the function
3745 * In other words, plug in "ma" in the range of "umap".
3746 * The result contains maps that live in the same spaces as the maps of "umap"
3751 __isl_take isl_union_map *umap, __isl_take isl_multi_aff *ma)
3753 return isl_union_map_preimage_range_pw_multi_aff(umap,
3819 /* Compute the preimage of the domain or range of "umap" under the function
3821 * In other words, plug in "mpa" in the domain or range of "umap".
3826 __isl_take isl_union_map *umap, __isl_take isl_multi_pw_aff *mpa,
3835 umap = isl_union_map_align_params(umap,
3837 mpa = isl_multi_pw_aff_align_params(mpa, isl_union_map_get_space(umap));
3839 if (!umap || !mpa)
3842 ctx = isl_union_map_get_ctx(umap);
3843 space = isl_union_map_get_space(umap);
3846 data.res = isl_union_map_alloc(space, umap->table.n);
3849 if (isl_hash_table_foreach(ctx, &umap->table, &preimage_mpa_entry,
3854 isl_union_map_free(umap);
3858 isl_union_map_free(umap);
3863 /* Compute the preimage of the domain of "umap" under the function
3865 * In other words, plug in "mpa" in the domain of "umap".
3866 * The result contains maps that live in the same spaces as the maps of "umap"
3871 __isl_take isl_union_map *umap, __isl_take isl_multi_pw_aff *mpa)
3873 return preimage_multi_pw_aff(umap, mpa, &domain_match,
3879 * "umap" is the map of which the preimage should be computed.
3884 isl_union_map *umap;
3886 __isl_give isl_union_map *(*fn)(__isl_take isl_union_map *umap,
3890 /* Call data->fn to compute the preimage of the domain or range of data->umap
3896 isl_union_map *umap;
3898 umap = isl_union_map_copy(data->umap);
3899 umap = data->fn(umap, pma);
3900 data->res = isl_union_map_union(data->res, umap);
3905 /* Compute the preimage of the domain or range of "umap" under the function
3907 * In other words, plug in "upma" in the domain or range of "umap".
3912 __isl_take isl_union_map *umap,
3914 __isl_give isl_union_map *(*fn)(__isl_take isl_union_map *umap,
3919 data.umap = umap;
3920 data.res = isl_union_map_empty(isl_union_map_get_space(umap));
3926 isl_union_map_free(umap);
3932 /* Compute the preimage of the domain of "umap" under the function
3934 * In other words, plug in "upma" in the domain of "umap".
3935 * The result contains maps that live in the same spaces as the maps of "umap"
3941 __isl_take isl_union_map *umap,
3944 return preimage_union_pw_multi_aff(umap, upma,
3948 /* Compute the preimage of the range of "umap" under the function
3950 * In other words, plug in "upma" in the range of "umap".
3951 * The result contains maps that live in the same spaces as the maps of "umap"
3957 __isl_take isl_union_map *umap,
3960 return preimage_union_pw_multi_aff(umap, upma,
3980 * of the spaces of "umap".
3983 __isl_take isl_union_map *umap)
3985 umap = isl_union_map_cow(umap);
3986 if (!umap)
3988 umap->dim = isl_space_reset_user(umap->dim);
3989 if (!umap->dim)
3990 return isl_union_map_free(umap);
3991 return total(umap, &isl_map_reset_user);
4004 * from "umap" using Fourier-Motzkin elimination.
4007 __isl_take isl_union_map *umap)
4009 return total(umap, &isl_map_remove_divs);
4053 __isl_take isl_union_map *umap,
4059 if (!umap)
4063 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
4065 return isl_union_map_free(umap));
4067 space = isl_union_map_get_space(umap);
4070 if (isl_union_map_foreach_map(umap, &project_out, &data) < 0)
4073 isl_union_map_free(umap);
4125 /* Does "umap" involve any of the n parameters starting at first?
4128 * "umap" involves any of those parameters if any of its maps
4129 * involve the parameters. In other words, "umap" does not
4133 isl_bool isl_union_map_involves_dims(__isl_keep isl_union_map *umap,
4140 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
4143 excludes = union_map_forall_user(umap, &map_excludes, &data);
4175 /* Replace the range space of all the maps in "umap" by
4185 __isl_take isl_union_map *umap, __isl_take isl_space *space)
4189 data.res = isl_union_map_empty(isl_union_map_get_space(umap));
4190 if (isl_union_map_foreach_map(umap, &reset_range_space, &data) < 0)
4194 isl_union_map_free(umap);
4198 /* Check that "umap" and "space" have the same number of parameters.
4200 static isl_stat check_union_map_space_equal_dim(__isl_keep isl_union_map *umap,
4205 dim1 = isl_union_map_dim(umap, isl_dim_param);
4211 isl_die(isl_union_map_get_ctx(umap), isl_error_invalid,
4240 /* Replace the space of "umap" by "space", without modifying
4241 * the dimension of "umap", i.e., the number of parameters of "umap".
4247 __isl_take isl_union_map *umap, __isl_take isl_space *space)
4253 umap_space = isl_union_map_peek_space(umap);
4259 return umap;
4261 if (check_union_map_space_equal_dim(umap, space) < 0)
4265 if (isl_union_map_foreach_map(umap, &reset_params, &data) < 0)
4269 isl_union_map_free(umap);
4272 isl_union_map_free(umap);
4313 * domain and range of "umap" with this explicit domain.
4318 __isl_take isl_union_map *umap, __isl_keep isl_multi_union_pw_aff *mupa)
4325 return isl_union_map_free(umap);
4327 return umap;
4333 return isl_union_map_free(umap);
4339 umap = isl_union_map_intersect_params(umap, set);
4340 return umap;
4342 umap = isl_union_map_intersect_domain(umap, isl_union_set_copy(dom));
4343 umap = isl_union_map_intersect_range(umap, dom);
4344 return umap;
4347 /* Intersect each map in "umap" with the result of calling "order"
4352 __isl_take isl_union_map *umap, __isl_take isl_multi_union_pw_aff *mupa,
4358 umap = isl_union_map_align_params(umap,
4361 isl_union_map_get_space(umap));
4362 umap = intersect_explicit_domain(umap, mupa);
4365 data.res = isl_union_map_empty(isl_union_map_get_space(umap));
4366 if (isl_union_map_foreach_map(umap, &order_at, &data) < 0)
4370 isl_union_map_free(umap);
4374 /* Return the subset of "umap" where the domain and the range
4378 __isl_take isl_union_map *umap,
4381 return isl_union_map_order_at_multi_union_pw_aff(umap, mupa,
4448 /* Return a hash value that digests "umap".
4450 uint32_t isl_union_map_get_hash(__isl_keep isl_union_map *umap)
4454 if (!umap)
4458 if (isl_union_map_foreach_map(umap, &add_hash, &hash) < 0)
4564 /* Call "fn" on every map in "umap" and remove those maps
4571 __isl_take isl_union_map *umap,
4580 return un_op(umap, &control);
4610 /* Bind the output dimensions of "umap" to parameters with identifiers
4611 * specified by "tuple", living in the range space of "umap",
4615 __isl_take isl_union_map *umap, __isl_take isl_multi_id *tuple)
4625 bound = uset_from_umap(un_op(umap, &control));
4630 /* Only keep those elements in "umap" that have a domain in "space".
4633 __isl_take isl_union_map *umap, __isl_take isl_space *space)
4640 umap = un_op(umap, &control);
4642 return umap;
4645 /* Only keep those elements in "umap" that have a range in "space".
4648 __isl_take isl_union_map *umap, __isl_take isl_space *space)
4655 umap = un_op(umap, &control);
4657 return umap;