2 #include <barvinok/util.h>
3 #include <barvinok/options.h>
6 static enum order_sign
interval_minmax(Polyhedron
*I
)
11 assert(I
->Dimension
== 1);
12 POL_ENSURE_VERTICES(I
);
13 for (i
= 0; i
< I
->NbRays
; ++i
) {
14 if (value_pos_p(I
->Ray
[i
][1]))
16 else if (value_neg_p(I
->Ray
[i
][1]))
38 /* Returns the sign of the affine function specified by T on the polyhedron D */
39 enum order_sign
PL_polyhedron_affine_sign(Polyhedron
*D
, Matrix
*T
,
40 struct barvinok_options
*options
)
43 Polyhedron
*I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
44 if (POL_ISSET(options
->MaxRays
, POL_INTEGER
))
45 I
= DomainConstraintSimplify(I
, options
->MaxRays
);
48 I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
50 sign
= interval_minmax(I
);
55 enum lp_result
PL_polyhedron_range(Polyhedron
*D
, Value
*obj
, Value denom
,
56 Value
*min
, Value
*max
,
57 struct barvinok_options
*options
)
62 Matrix
*T
= Matrix_Alloc(2, D
->Dimension
+1);
63 Vector_Copy(obj
, T
->p
[0], D
->Dimension
+1);
64 value_assign(T
->p
[1][D
->Dimension
], denom
);
66 I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
68 POL_ENSURE_VERTICES(I
);
74 bounded
= line_minmax(I
, min
, max
);
78 if (value_gt(*min
, *max
))