1 #include <barvinok/util.h>
2 #include <barvinok/options.h>
5 static enum order_sign
interval_minmax(Polyhedron
*I
)
10 assert(I
->Dimension
== 1);
11 POL_ENSURE_VERTICES(I
);
12 for (i
= 0; i
< I
->NbRays
; ++i
) {
13 if (value_pos_p(I
->Ray
[i
][1]))
15 else if (value_neg_p(I
->Ray
[i
][1]))
37 /* Returns the sign of the affine function specified by T on the polyhedron D */
38 enum order_sign
PL_polyhedron_affine_sign(Polyhedron
*D
, Matrix
*T
,
39 struct barvinok_options
*options
)
42 Polyhedron
*I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
43 if (POL_ISSET(options
->MaxRays
, POL_INTEGER
))
44 I
= DomainConstraintSimplify(I
, options
->MaxRays
);
47 I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
49 sign
= interval_minmax(I
);
54 enum lp_result
PL_polyhedron_range(Polyhedron
*D
, Value
*obj
, Value denom
,
55 Value
*min
, Value
*max
,
56 struct barvinok_options
*options
)
61 Matrix
*T
= Matrix_Alloc(2, D
->Dimension
+1);
62 Vector_Copy(obj
, T
->p
[0], D
->Dimension
+1);
63 value_assign(T
->p
[1][D
->Dimension
], denom
);
65 I
= Polyhedron_Image(D
, T
, options
->MaxRays
);
67 POL_ENSURE_VERTICES(I
);
73 bounded
= line_minmax(I
, min
, max
);
77 if (value_gt(*min
, *max
))