X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_ilp.c;h=2072bf6835917a7e158b0fe59f1f21f24f173093;hb=f44a1a3e730acbedf80309eeb4884f2a6bcba7d7;hp=1f6b70db58849d33a8e94342d6555fc0ee2bcce6;hpb=83df5261cdcb85fcfd9aebeaaf77f377216dd82e;p=platform%2Fupstream%2Fisl.git diff --git a/isl_ilp.c b/isl_ilp.c index 1f6b70d..2072bf6 100644 --- a/isl_ilp.c +++ b/isl_ilp.c @@ -583,3 +583,53 @@ __isl_give isl_val *isl_basic_set_max_val(__isl_keep isl_basic_set *bset, { return isl_basic_set_opt_val(bset, 1, obj); } + +/* Return the minimum (maximum if max is set) of the integer affine + * expression "obj" over the points in "set". + * + * Return infinity or negative infinity if the optimal value is unbounded and + * NaN if "bset" is empty. + * + * Call isl_set_opt and translate the results. + */ +__isl_give isl_val *isl_set_opt_val(__isl_keep isl_set *set, int max, + __isl_keep isl_aff *obj) +{ + isl_ctx *ctx; + isl_val *res; + enum isl_lp_result lp_res; + + if (!set || !obj) + return NULL; + + ctx = isl_aff_get_ctx(obj); + res = isl_val_alloc(ctx); + if (!res) + return NULL; + lp_res = isl_set_opt(set, max, obj, &res->n); + return convert_lp_result(lp_res, res, max); +} + +/* Return the minimum of the integer affine + * expression "obj" over the points in "set". + * + * Return infinity or negative infinity if the optimal value is unbounded and + * NaN if "bset" is empty. + */ +__isl_give isl_val *isl_set_min_val(__isl_keep isl_set *set, + __isl_keep isl_aff *obj) +{ + return isl_set_opt_val(set, 0, obj); +} + +/* Return the maximum of the integer affine + * expression "obj" over the points in "set". + * + * Return infinity or negative infinity if the optimal value is unbounded and + * NaN if "bset" is empty. + */ +__isl_give isl_val *isl_set_max_val(__isl_keep isl_set *set, + __isl_keep isl_aff *obj) +{ + return isl_set_opt_val(set, 1, obj); +}