2 #include <isl_set_polylib.h>
3 #include <barvinok/basis_reduction.h>
4 #include <barvinok/options.h>
8 Matrix
*glpk_Polyhedron_Reduced_Basis(Polyhedron
*P
,
9 struct barvinok_options
*options
)
15 #ifndef HAVE_LIBCDDGMP
16 Matrix
*cdd_Polyhedron_Reduced_Basis(Polyhedron
*P
,
17 struct barvinok_options
*options
)
23 Matrix
*isl_Polyhedron_Reduced_Basis(Polyhedron
*P
,
24 struct barvinok_options
*options
)
30 int nvar
= P
->Dimension
;
34 int isl_gbr_only_first
= options
->isl
->gbr_only_first
;
36 options
->isl
->gbr_only_first
= options
->gbr_only_first
;
37 ctx
= isl_ctx_alloc_with_options(barvinok_options_arg
, options
);
40 dim
= isl_space_set_alloc(ctx
, 0, nvar
);
41 bset
= isl_basic_set_new_from_polylib(P
, dim
);
43 basis
= isl_basic_set_reduced_basis(bset
);
44 isl_basic_set_free(bset
);
46 M
= Matrix_Alloc(nvar
, nvar
);
49 for (i
= 0; i
< nvar
; ++i
)
50 for (j
= 0; j
< nvar
; ++j
) {
51 isl_mat_get_element(basis
, 1 + i
, 1 + j
, &v
);
52 isl_int_get_gmp(v
, M
->p
[i
][j
]);
60 options
->isl
->gbr_only_first
= isl_gbr_only_first
;
65 Matrix
*Polyhedron_Reduced_Basis(Polyhedron
*P
, struct barvinok_options
*options
)
67 if (options
->gbr_lp_solver
== BV_GBR_GLPK
)
68 return glpk_Polyhedron_Reduced_Basis(P
, options
);
69 else if (options
->gbr_lp_solver
== BV_GBR_CDD
)
70 return cdd_Polyhedron_Reduced_Basis(P
, options
);
71 else if (options
->gbr_lp_solver
== BV_GBR_ISL
)
72 return isl_Polyhedron_Reduced_Basis(P
, options
);