2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
13 #include "isl_piplib.h"
14 #include "isl_sample_piplib.h"
16 struct isl_vec
*isl_pip_basic_set_sample(struct isl_basic_set
*bset
)
18 PipOptions
*options
= NULL
;
19 PipMatrix
*domain
= NULL
;
21 struct isl_vec
*vec
= NULL
;
28 isl_assert(ctx
, isl_basic_set_n_param(bset
) == 0, goto error
);
29 isl_assert(ctx
, bset
->n_div
== 0, goto error
);
30 dim
= isl_basic_set_n_dim(bset
);
31 domain
= isl_basic_map_to_pip((struct isl_basic_map
*)bset
, 0, 0, 0);
35 options
= pip_options_init();
38 sol
= pip_solve(domain
, NULL
, -1, options
);
42 vec
= isl_vec_alloc(ctx
, 0);
46 vec
= isl_vec_alloc(ctx
, 1 + dim
);
49 isl_int_set_si(vec
->block
.data
[0], 1);
50 for (i
= 0, l
= sol
->list
; l
&& i
< dim
; ++i
, l
= l
->next
) {
51 isl_seq_cpy_from_pip(&vec
->block
.data
[1+i
],
52 &l
->vector
->the_vector
[0], 1);
53 isl_assert(ctx
, !entier_zero_p(l
->vector
->the_deno
[0]),
56 isl_assert(ctx
, i
== dim
, goto error
);
60 pip_options_free(options
);
61 pip_matrix_free(domain
);
63 isl_basic_set_free(bset
);
67 isl_basic_set_free(bset
);
71 pip_matrix_free(domain
);