2 #include <isl/val_gmp.h>
3 #include <isl_set_polylib.h>
4 #include <barvinok/sample.h>
6 Vector
*Polyhedron_Sample(Polyhedron
*P
, struct barvinok_options
*options
)
9 isl_ctx
*ctx
= isl_ctx_alloc();
11 int nvar
= P
->Dimension
;
14 Vector
*sample
= NULL
;
16 dim
= isl_space_set_alloc(ctx
, 0, nvar
);
17 bset
= isl_basic_set_new_from_polylib(P
, dim
);
18 pnt
= isl_basic_set_sample_point(bset
);
20 if (!isl_point_is_void(pnt
)) {
23 sample
= Vector_Alloc(1 + nvar
);
25 for (i
= 0; i
< nvar
; ++i
) {
26 v
= isl_point_get_coordinate_val(pnt
, isl_dim_set
, i
);
27 isl_val_get_num_gmp(v
, sample
->p
[i
]);
30 value_set_si(sample
->p
[nvar
], 1);