4 #include <isl/val_gmp.h>
8 #include <isl_set_polylib.h>
9 #include <barvinok/polylib.h>
10 #include <barvinok/sample.h>
12 Vector
*Polyhedron_Sample(Polyhedron
*P
, struct barvinok_options
*options
)
15 isl_ctx
*ctx
= isl_ctx_alloc();
17 int nvar
= P
->Dimension
;
20 Vector
*sample
= NULL
;
22 dim
= isl_space_set_alloc(ctx
, 0, nvar
);
23 bset
= isl_basic_set_new_from_polylib(P
, dim
);
24 pnt
= isl_basic_set_sample_point(bset
);
26 if (!isl_point_is_void(pnt
)) {
29 sample
= Vector_Alloc(1 + nvar
);
31 for (i
= 0; i
< nvar
; ++i
) {
32 v
= isl_point_get_coordinate_val(pnt
, isl_dim_set
, i
);
33 isl_val_get_num_gmp(v
, sample
->p
[i
]);
36 value_set_si(sample
->p
[nvar
], 1);