return NULL;
}
+enum isl_fold isl_qpolynomial_fold_get_type(__isl_keep isl_qpolynomial_fold *fold)
+{
+ if (!fold)
+ return isl_fold_list;
+ return fold->type;
+}
+
+__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
+ __isl_take isl_qpolynomial_fold *fold, __isl_take isl_dim *dim)
+{
+ int i;
+ isl_ctx *ctx;
+
+ if (!fold || !dim)
+ goto error;
+
+ if (isl_dim_equal(fold->dim, dim)) {
+ isl_dim_free(dim);
+ return fold;
+ }
+
+ fold = isl_qpolynomial_fold_cow(fold);
+ if (!fold)
+ goto error;
+
+ isl_dim_free(fold->dim);
+ fold->dim = isl_dim_copy(dim);
+ if (!fold->dim)
+ goto error;
+
+ for (i = 0; i < fold->n; ++i) {
+ fold->qp[i] = isl_qpolynomial_lift(fold->qp[i],
+ isl_dim_copy(dim));
+ if (!fold->qp[i])
+ goto error;
+ }
+
+ isl_dim_free(dim);
+
+ return fold;
+error:
+ isl_qpolynomial_fold_free(fold);
+ isl_dim_free(dim);
+ return NULL;
+}
+
+int isl_qpolynomial_fold_foreach_qpolynomial(
+ __isl_keep isl_qpolynomial_fold *fold,
+ int (*fn)(__isl_take isl_qpolynomial *qp, void *user), void *user)
+{
+ int i;
+
+ if (!fold)
+ return -1;
+
+ for (i = 0; i < fold->n; ++i)
+ if (fn(isl_qpolynomial_copy(fold->qp[i]), user) < 0)
+ return -1;
+
+ return 0;
+}
+
__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_move_dims(
__isl_take isl_qpolynomial_fold *fold,
enum isl_dim_type dst_type, unsigned dst_pos,