1 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
2 #define FN(TYPE,NAME) xFN(TYPE,NAME)
3 #define xS(TYPE,NAME) struct TYPE ## _ ## NAME
4 #define S(TYPE,NAME) xS(TYPE,NAME)
7 __isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim,
8 enum isl_fold type, int n)
10 __isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, int n)
18 ctx = isl_space_get_ctx(dim);
19 isl_assert(ctx, n >= 0, goto error);
20 pw = isl_alloc(ctx, struct PW,
21 sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
39 __isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
41 return FN(PW,alloc_size)(dim, type, 0);
44 __isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim)
46 return FN(PW,alloc_size)(dim, 0);
50 __isl_give PW *FN(PW,add_piece)(__isl_take PW *pw,
51 __isl_take isl_set *set, __isl_take EL *el)
54 isl_space *el_dim = NULL;
56 if (!pw || !set || !el)
59 if (isl_set_plain_is_empty(set) || FN(EL,EL_IS_ZERO)(el)) {
65 ctx = isl_set_get_ctx(set);
67 if (pw->type != el->type)
68 isl_die(ctx, isl_error_invalid, "fold types don't match",
71 el_dim = FN(EL,get_space(el));
72 isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
73 isl_assert(ctx, pw->n < pw->size, goto error);
75 pw->p[pw->n].set = set;
76 pw->p[pw->n].FIELD = el;
79 isl_space_free(el_dim);
82 isl_space_free(el_dim);
90 __isl_give PW *FN(PW,alloc)(enum isl_fold type,
91 __isl_take isl_set *set, __isl_take EL *el)
93 __isl_give PW *FN(PW,alloc)(__isl_take isl_set *set, __isl_take EL *el)
102 pw = FN(PW,alloc_size)(isl_set_get_space(set), type, 1);
104 pw = FN(PW,alloc_size)(isl_set_get_space(set), 1);
107 return FN(PW,add_piece)(pw, set, el);
114 __isl_give PW *FN(PW,dup)(__isl_keep PW *pw)
123 dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
125 dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
130 for (i = 0; i < pw->n; ++i)
131 dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
132 FN(EL,copy)(pw->p[i].FIELD));
137 __isl_give PW *FN(PW,cow)(__isl_take PW *pw)
145 return FN(PW,dup)(pw);
148 __isl_give PW *FN(PW,copy)(__isl_keep PW *pw)
157 void *FN(PW,free)(__isl_take PW *pw)
166 for (i = 0; i < pw->n; ++i) {
167 isl_set_free(pw->p[i].set);
168 FN(EL,free)(pw->p[i].FIELD);
170 isl_space_free(pw->dim);
176 int FN(PW,IS_ZERO)(__isl_keep PW *pw)
185 __isl_give PW *FN(PW,realign)(__isl_take PW *pw, __isl_take isl_reordering *exp)
193 for (i = 0; i < pw->n; ++i) {
194 pw->p[i].set = isl_set_realign(pw->p[i].set,
195 isl_reordering_copy(exp));
198 pw->p[i].FIELD = FN(EL,realign)(pw->p[i].FIELD,
199 isl_reordering_copy(exp));
204 pw = FN(PW,reset_space)(pw, isl_space_copy(exp->dim));
206 isl_reordering_free(exp);
209 isl_reordering_free(exp);
214 /* Align the parameters of "pw" to those of "model".
216 __isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model)
223 ctx = isl_space_get_ctx(model);
224 if (!isl_space_has_named_params(model))
225 isl_die(ctx, isl_error_invalid,
226 "model has unnamed parameters", goto error);
227 if (!isl_space_has_named_params(pw->dim))
228 isl_die(ctx, isl_error_invalid,
229 "input has unnamed parameters", goto error);
230 if (!isl_space_match(pw->dim, isl_dim_param, model, isl_dim_param)) {
233 model = isl_space_drop_dims(model, isl_dim_in,
234 0, isl_space_dim(model, isl_dim_in));
235 model = isl_space_drop_dims(model, isl_dim_out,
236 0, isl_space_dim(model, isl_dim_out));
237 exp = isl_parameter_alignment_reordering(pw->dim, model);
238 exp = isl_reordering_extend_space(exp, FN(PW,get_space)(pw));
239 pw = FN(PW,realign)(pw, exp);
242 isl_space_free(model);
245 isl_space_free(model);
250 static __isl_give PW *align_params_pw_pw_and(__isl_take PW *pw1,
252 __isl_give PW *(*fn)(__isl_take PW *pw1, __isl_take PW *pw2))
258 if (isl_space_match(pw1->dim, isl_dim_param, pw2->dim, isl_dim_param))
260 ctx = FN(PW,get_ctx)(pw1);
261 if (!isl_space_has_named_params(pw1->dim) ||
262 !isl_space_has_named_params(pw2->dim))
263 isl_die(ctx, isl_error_invalid,
264 "unaligned unnamed parameters", goto error);
265 pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
266 pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
274 static __isl_give PW *align_params_pw_set_and(__isl_take PW *pw,
275 __isl_take isl_set *set,
276 __isl_give PW *(*fn)(__isl_take PW *pw, __isl_take isl_set *set))
282 if (isl_space_match(pw->dim, isl_dim_param, set->dim, isl_dim_param))
284 ctx = FN(PW,get_ctx)(pw);
285 if (!isl_space_has_named_params(pw->dim) ||
286 !isl_space_has_named_params(set->dim))
287 isl_die(ctx, isl_error_invalid,
288 "unaligned unnamed parameters", goto error);
289 pw = FN(PW,align_params)(pw, isl_set_get_space(set));
290 set = isl_set_align_params(set, FN(PW,get_space)(pw));
299 static __isl_give PW *FN(PW,add_aligned)(__isl_take PW *pw1, __isl_take PW *pw2)
309 ctx = isl_space_get_ctx(pw1->dim);
311 if (pw1->type != pw2->type)
312 isl_die(ctx, isl_error_invalid,
313 "fold types don't match", goto error);
315 isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
317 if (FN(PW,IS_ZERO)(pw1)) {
322 if (FN(PW,IS_ZERO)(pw2)) {
327 n = (pw1->n + 1) * (pw2->n + 1);
329 res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
331 res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
334 for (i = 0; i < pw1->n; ++i) {
335 set = isl_set_copy(pw1->p[i].set);
336 for (j = 0; j < pw2->n; ++j) {
337 struct isl_set *common;
339 set = isl_set_subtract(set,
340 isl_set_copy(pw2->p[j].set));
341 common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
342 isl_set_copy(pw2->p[j].set));
343 if (isl_set_plain_is_empty(common)) {
344 isl_set_free(common);
348 sum = FN(EL,add_on_domain)(common,
349 FN(EL,copy)(pw1->p[i].FIELD),
350 FN(EL,copy)(pw2->p[j].FIELD));
352 res = FN(PW,add_piece)(res, common, sum);
354 res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
357 for (j = 0; j < pw2->n; ++j) {
358 set = isl_set_copy(pw2->p[j].set);
359 for (i = 0; i < pw1->n; ++i)
360 set = isl_set_subtract(set,
361 isl_set_copy(pw1->p[i].set));
362 res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
375 __isl_give PW *FN(PW,add)(__isl_take PW *pw1, __isl_take PW *pw2)
377 return align_params_pw_pw_and(pw1, pw2, &FN(PW,add_aligned));
380 /* Make sure "pw" has room for at least "n" more pieces.
382 * If there is only one reference to pw, we extend it in place.
383 * Otherwise, we create a new PW and copy the pieces.
385 static __isl_give PW *FN(PW,grow)(__isl_take PW *pw, int n)
393 if (pw->n + n <= pw->size)
395 ctx = FN(PW,get_ctx)(pw);
398 res = isl_realloc(ctx, pw, struct PW,
399 sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
401 return FN(PW,free)(pw);
406 res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
408 res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
411 return FN(PW,free)(pw);
412 for (i = 0; i < pw->n; ++i)
413 res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
414 FN(EL,copy)(pw->p[i].FIELD));
419 static __isl_give PW *FN(PW,add_disjoint_aligned)(__isl_take PW *pw1,
428 if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n)
429 return FN(PW,add_disjoint_aligned)(pw2, pw1);
431 ctx = isl_space_get_ctx(pw1->dim);
433 if (pw1->type != pw2->type)
434 isl_die(ctx, isl_error_invalid,
435 "fold types don't match", goto error);
437 isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
439 if (FN(PW,IS_ZERO)(pw1)) {
444 if (FN(PW,IS_ZERO)(pw2)) {
449 pw1 = FN(PW,grow)(pw1, pw2->n);
453 for (i = 0; i < pw2->n; ++i)
454 pw1 = FN(PW,add_piece)(pw1,
455 isl_set_copy(pw2->p[i].set),
456 FN(EL,copy)(pw2->p[i].FIELD));
467 __isl_give PW *FN(PW,add_disjoint)(__isl_take PW *pw1, __isl_take PW *pw2)
469 return align_params_pw_pw_and(pw1, pw2, &FN(PW,add_disjoint_aligned));
473 __isl_give PW *FN(PW,neg)(__isl_take PW *pw)
480 if (FN(PW,IS_ZERO)(pw))
487 for (i = 0; i < pw->n; ++i) {
488 pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
490 return FN(PW,free)(pw);
496 __isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2)
498 return FN(PW,add)(pw1, FN(PW,neg)(pw2));
503 __isl_give isl_qpolynomial *FN(PW,eval)(__isl_take PW *pw,
504 __isl_take isl_point *pnt)
509 isl_space *pnt_dim = NULL;
514 ctx = isl_point_get_ctx(pnt);
515 pnt_dim = isl_point_get_space(pnt);
516 isl_assert(ctx, isl_space_is_equal(pnt_dim, pw->dim), goto error);
518 for (i = 0; i < pw->n; ++i) {
519 found = isl_set_contains_point(pw->p[i].set, pnt);
526 qp = FN(EL,eval)(FN(EL,copy)(pw->p[i].FIELD),
527 isl_point_copy(pnt));
529 qp = isl_qpolynomial_zero(isl_space_copy(pw->dim));
531 isl_space_free(pnt_dim);
536 isl_space_free(pnt_dim);
542 __isl_give isl_set *FN(PW,domain)(__isl_take PW *pw)
550 dom = isl_set_empty(isl_space_copy(pw->dim));
551 for (i = 0; i < pw->n; ++i)
552 dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
559 static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw,
560 __isl_take isl_set *set)
576 for (i = pw->n - 1; i >= 0; --i) {
578 pw->p[i].set = isl_set_intersect(pw->p[i].set, isl_set_copy(set));
581 aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
582 pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD,
584 if (isl_set_plain_is_empty(pw->p[i].set)) {
585 isl_set_free(pw->p[i].set);
586 FN(EL,free)(pw->p[i].FIELD);
588 pw->p[i] = pw->p[pw->n - 1];
601 __isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw,
602 __isl_take isl_set *context)
604 return align_params_pw_set_and(pw, context,
605 &FN(PW,intersect_domain_aligned));
608 static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw,
609 __isl_take isl_set *context)
612 isl_basic_set *hull = NULL;
618 isl_set_free(context);
622 if (!isl_space_match(pw->dim, isl_dim_param,
623 context->dim, isl_dim_param)) {
624 pw = FN(PW,align_params)(pw, isl_set_get_space(context));
625 context = isl_set_align_params(context, FN(PW,get_space)(pw));
628 context = isl_set_compute_divs(context);
629 hull = isl_set_simple_hull(isl_set_copy(context));
635 for (i = pw->n - 1; i >= 0; --i) {
636 pw->p[i].set = isl_set_intersect(pw->p[i].set,
637 isl_set_copy(context));
640 pw->p[i].FIELD = FN(EL,gist)(pw->p[i].FIELD,
641 isl_set_copy(pw->p[i].set));
642 pw->p[i].set = isl_set_gist_basic_set(pw->p[i].set,
643 isl_basic_set_copy(hull));
646 if (isl_set_plain_is_empty(pw->p[i].set)) {
647 isl_set_free(pw->p[i].set);
648 FN(EL,free)(pw->p[i].FIELD);
650 pw->p[i] = pw->p[pw->n - 1];
655 isl_basic_set_free(hull);
656 isl_set_free(context);
661 isl_basic_set_free(hull);
662 isl_set_free(context);
666 __isl_give PW *FN(PW,gist)(__isl_take PW *pw, __isl_take isl_set *context)
668 return align_params_pw_set_and(pw, context, &FN(PW,gist_aligned));
671 __isl_give PW *FN(PW,coalesce)(__isl_take PW *pw)
680 for (i = pw->n - 1; i >= 0; --i) {
681 for (j = i - 1; j >= 0; --j) {
682 if (!FN(EL,plain_is_equal)(pw->p[i].FIELD,
685 pw->p[j].set = isl_set_union(pw->p[j].set,
687 FN(EL,free)(pw->p[i].FIELD);
689 pw->p[i] = pw->p[pw->n - 1];
695 pw->p[i].set = isl_set_coalesce(pw->p[i].set);
706 isl_ctx *FN(PW,get_ctx)(__isl_keep PW *pw)
708 return pw ? isl_space_get_ctx(pw->dim) : NULL;
711 #ifndef NO_INVOLVES_DIMS
712 int FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type,
713 unsigned first, unsigned n)
719 if (pw->n == 0 || n == 0)
721 for (i = 0; i < pw->n; ++i) {
722 int involves = FN(EL,involves_dims)(pw->p[i].FIELD,
724 if (involves < 0 || involves)
726 involves = isl_set_involves_dims(pw->p[i].set, type, first, n);
727 if (involves < 0 || involves)
734 __isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw,
735 enum isl_dim_type type, unsigned pos, const char *s)
743 pw->dim = isl_space_set_dim_name(pw->dim, type, pos, s);
747 for (i = 0; i < pw->n; ++i) {
748 pw->p[i].set = isl_set_set_dim_name(pw->p[i].set, type, pos, s);
751 pw->p[i].FIELD = FN(EL,set_dim_name)(pw->p[i].FIELD, type, pos, s);
763 __isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw,
764 enum isl_dim_type type, unsigned first, unsigned n)
770 if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
776 pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
779 for (i = 0; i < pw->n; ++i) {
780 pw->p[i].set = isl_set_drop(pw->p[i].set, type, first, n);
783 pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
794 /* This function is very similar to drop_dims.
795 * The only difference is that the cells may still involve
796 * the specified dimensions. They are removed using
797 * isl_set_project_out instead of isl_set_drop.
799 __isl_give PW *FN(PW,project_out)(__isl_take PW *pw,
800 enum isl_dim_type type, unsigned first, unsigned n)
806 if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
812 pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
815 for (i = 0; i < pw->n; ++i) {
816 pw->p[i].set = isl_set_project_out(pw->p[i].set, type, first, n);
819 pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
830 /* Project the domain of pw onto its parameter space.
832 __isl_give PW *FN(PW,project_domain_on_params)(__isl_take PW *pw)
837 n = FN(PW,dim)(pw, isl_dim_set);
838 pw = FN(PW,project_out)(pw, isl_dim_set, 0, n);
839 space = FN(PW,get_space)(pw);
840 space = isl_space_params(space);
841 pw = FN(PW,reset_space)(pw, space);
846 #ifndef NO_INSERT_DIMS
847 __isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type,
848 unsigned first, unsigned n)
854 if (n == 0 && !isl_space_is_named_or_nested(pw->dim, type))
861 pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
865 for (i = 0; i < pw->n; ++i) {
866 pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
870 pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD,
883 __isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw,
884 enum isl_dim_type type, unsigned pos, isl_int v)
894 for (i = 0; i < pw->n; ++i) {
895 pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
906 unsigned FN(PW,dim)(__isl_keep PW *pw, enum isl_dim_type type)
908 return pw ? isl_space_dim(pw->dim, type) : 0;
911 __isl_give PW *FN(PW,split_dims)(__isl_take PW *pw,
912 enum isl_dim_type type, unsigned first, unsigned n)
926 for (i = 0; i < pw->n; ++i) {
927 pw->p[i].set = isl_set_split_dims(pw->p[i].set, type, first, n);
939 /* Compute the maximal value attained by the piecewise quasipolynomial
940 * on its domain or zero if the domain is empty.
941 * In the worst case, the domain is scanned completely,
942 * so the domain is assumed to be bounded.
944 __isl_give isl_qpolynomial *FN(PW,opt)(__isl_take PW *pw, int max)
947 isl_qpolynomial *opt;
953 isl_space *dim = isl_space_copy(pw->dim);
955 return isl_qpolynomial_zero(dim);
958 opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD),
959 isl_set_copy(pw->p[0].set), max);
960 for (i = 1; i < pw->n; ++i) {
961 isl_qpolynomial *opt_i;
962 opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD),
963 isl_set_copy(pw->p[i].set), max);
965 opt = isl_qpolynomial_max_cst(opt, opt_i);
967 opt = isl_qpolynomial_min_cst(opt, opt_i);
974 __isl_give isl_qpolynomial *FN(PW,max)(__isl_take PW *pw)
976 return FN(PW,opt)(pw, 1);
979 __isl_give isl_qpolynomial *FN(PW,min)(__isl_take PW *pw)
981 return FN(PW,opt)(pw, 0);
985 __isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw)
987 return pw ? isl_space_copy(pw->dim) : NULL;
991 __isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim)
999 for (i = 0; i < pw->n; ++i) {
1000 pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1001 isl_space_copy(dim));
1004 pw->p[i].FIELD = FN(EL,reset_space)(pw->p[i].FIELD,
1005 isl_space_copy(dim));
1006 if (!pw->p[i].FIELD)
1009 isl_space_free(pw->dim);
1014 isl_space_free(dim);
1020 int FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2)
1025 return isl_space_is_equal(pw1->dim, pw2->dim);
1029 __isl_give PW *FN(PW,morph)(__isl_take PW *pw, __isl_take isl_morph *morph)
1037 ctx = isl_space_get_ctx(pw->dim);
1038 isl_assert(ctx, isl_space_is_equal(pw->dim, morph->dom->dim),
1041 pw = FN(PW,cow)(pw);
1044 isl_space_free(pw->dim);
1045 pw->dim = isl_space_copy(morph->ran->dim);
1049 for (i = 0; i < pw->n; ++i) {
1050 pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set);
1053 pw->p[i].FIELD = FN(EL,morph)(pw->p[i].FIELD,
1054 isl_morph_copy(morph));
1055 if (!pw->p[i].FIELD)
1059 isl_morph_free(morph);
1064 isl_morph_free(morph);
1069 int FN(PW,foreach_piece)(__isl_keep PW *pw,
1070 int (*fn)(__isl_take isl_set *set, __isl_take EL *el, void *user),
1078 for (i = 0; i < pw->n; ++i)
1079 if (fn(isl_set_copy(pw->p[i].set),
1080 FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1087 static int any_divs(__isl_keep isl_set *set)
1094 for (i = 0; i < set->n; ++i)
1095 if (set->p[i]->n_div > 0)
1101 static int foreach_lifted_subset(__isl_take isl_set *set, __isl_take EL *el,
1102 int (*fn)(__isl_take isl_set *set, __isl_take EL *el,
1103 void *user), void *user)
1110 for (i = 0; i < set->n; ++i) {
1114 lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
1115 lift = isl_set_lift(lift);
1117 copy = FN(EL,copy)(el);
1118 copy = FN(EL,lift)(copy, isl_set_get_space(lift));
1120 if (fn(lift, copy, user) < 0)
1134 int FN(PW,foreach_lifted_piece)(__isl_keep PW *pw,
1135 int (*fn)(__isl_take isl_set *set, __isl_take EL *el,
1136 void *user), void *user)
1143 for (i = 0; i < pw->n; ++i) {
1147 set = isl_set_copy(pw->p[i].set);
1148 el = FN(EL,copy)(pw->p[i].FIELD);
1149 if (!any_divs(set)) {
1150 if (fn(set, el, user) < 0)
1154 if (foreach_lifted_subset(set, el, fn, user) < 0)
1162 #ifndef NO_MOVE_DIMS
1163 __isl_give PW *FN(PW,move_dims)(__isl_take PW *pw,
1164 enum isl_dim_type dst_type, unsigned dst_pos,
1165 enum isl_dim_type src_type, unsigned src_pos, unsigned n)
1169 pw = FN(PW,cow)(pw);
1173 pw->dim = isl_space_move_dims(pw->dim, dst_type, dst_pos, src_type, src_pos, n);
1177 for (i = 0; i < pw->n; ++i) {
1178 pw->p[i].set = isl_set_move_dims(pw->p[i].set,
1180 src_type, src_pos, n);
1183 pw->p[i].FIELD = FN(EL,move_dims)(pw->p[i].FIELD,
1184 dst_type, dst_pos, src_type, src_pos, n);
1185 if (!pw->p[i].FIELD)
1196 __isl_give PW *FN(PW,mul_isl_int)(__isl_take PW *pw, isl_int v)
1200 if (isl_int_is_one(v))
1202 if (pw && isl_int_is_zero(v)) {
1204 isl_space *dim = FN(PW,get_space)(pw);
1206 zero = FN(PW,ZERO)(dim, pw->type);
1208 zero = FN(PW,ZERO)(dim);
1213 pw = FN(PW,cow)(pw);
1220 if (isl_int_is_neg(v))
1221 pw->type = isl_fold_type_negate(pw->type);
1223 for (i = 0; i < pw->n; ++i) {
1224 pw->p[i].FIELD = FN(EL,scale)(pw->p[i].FIELD, v);
1225 if (!pw->p[i].FIELD)
1235 __isl_give PW *FN(PW,scale)(__isl_take PW *pw, isl_int v)
1237 return FN(PW,mul_isl_int)(pw, v);