2 * Copyright 2019 Cerebras Systems
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
10 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
11 #define FN(TYPE,NAME) xFN(TYPE,NAME)
13 /* Return a list of minima (maxima if "max" is set)
14 * for each of the expressions in "f" over their (shared) domain.
16 * An element in the list is infinity or negative infinity if the optimal
17 * value of the corresponding expression is unbounded and
18 * NaN if the domain of the expression is empty.
20 * Iterate over all the expressions in "f" and collect the results.
22 static __isl_give isl_multi_val
*FN(TYPE
,opt_multi_val
)(__isl_take TYPE
*f
,
30 n
= FN(TYPE
,dim
)(f
, isl_dim_out
);
36 space
= isl_space_range(FN(TYPE
,get_space
)(f
));
37 space
= isl_space_drop_all_params(space
);
38 mv
= isl_multi_val_zero(space
);
40 for (i
= 0; i
< n
; ++i
) {
44 pa
= FN(TYPE
,get_pw_aff
)(f
, i
);
45 v
= isl_pw_aff_opt_val(pa
, max
);
46 mv
= isl_multi_val_set_val(mv
, i
, v
);
53 /* Return a list of minima
54 * for each of the expressions in "f" over their (shared) domain.
56 * An element in the list is negative infinity if the optimal
57 * value of the corresponding expression is unbounded and
58 * NaN if the domain of the expression is empty.
60 __isl_give isl_multi_val
*FN(TYPE
,min_multi_val
)(__isl_take TYPE
*f
)
62 return FN(TYPE
,opt_multi_val
)(f
, 0);
65 /* Return a list of maxima
66 * for each of the expressions in "f" over their (shared) domain.
68 * An element in the list is infinity if the optimal
69 * value of the corresponding expression is unbounded and
70 * NaN if the domain of the expression is empty.
72 __isl_give isl_multi_val
*FN(TYPE
,max_multi_val
)(__isl_take TYPE
*f
)
74 return FN(TYPE
,opt_multi_val
)(f
, 1);