2 #include <isl_set_polylib.h>
3 #include <barvinok/sample.h>
5 Vector
*Polyhedron_Sample(Polyhedron
*P
, struct barvinok_options
*options
)
8 isl_ctx
*ctx
= isl_ctx_alloc();
10 int nvar
= P
->Dimension
;
13 Vector
*sample
= NULL
;
15 dim
= isl_space_set_alloc(ctx
, 0, nvar
);
16 bset
= isl_basic_set_new_from_polylib(P
, dim
);
17 pnt
= isl_basic_set_sample_point(bset
);
19 if (!isl_point_is_void(pnt
)) {
23 sample
= Vector_Alloc(1 + nvar
);
25 for (i
= 0; i
< nvar
; ++i
) {
26 isl_point_get_coordinate(pnt
, isl_dim_set
, i
, &v
);
27 isl_int_get_gmp(v
, sample
->p
[i
]);
29 value_set_si(sample
->p
[nvar
], 1);