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
)
24 Matrix
*pip_Polyhedron_Reduced_Basis(Polyhedron
*P
,
25 struct barvinok_options
*options
)
29 Matrix
*pip_dual_Polyhedron_Reduced_Basis(Polyhedron
*P
,
30 struct barvinok_options
*options
)
36 Matrix
*isl_Polyhedron_Reduced_Basis(Polyhedron
*P
,
37 struct barvinok_options
*options
)
41 isl_ctx
*ctx
= isl_ctx_alloc();
43 int nvar
= P
->Dimension
;
49 ctx
->opt
->gbr_only_first
= options
->gbr_only_first
;
51 dim
= isl_dim_set_alloc(ctx
, 0, nvar
);
52 bset
= isl_basic_set_new_from_polylib(P
, dim
);
54 basis
= isl_basic_set_reduced_basis(bset
);
55 isl_basic_set_free(bset
);
57 M
= Matrix_Alloc(nvar
, nvar
);
60 for (i
= 0; i
< nvar
; ++i
)
61 for (j
= 0; j
< nvar
; ++j
) {
62 isl_mat_get_element(basis
, 1 + i
, 1 + j
, &v
);
63 isl_int_get_gmp(v
, M
->p
[i
][j
]);
74 Matrix
*Polyhedron_Reduced_Basis(Polyhedron
*P
, struct barvinok_options
*options
)
76 if (options
->gbr_lp_solver
== BV_GBR_GLPK
)
77 return glpk_Polyhedron_Reduced_Basis(P
, options
);
78 else if (options
->gbr_lp_solver
== BV_GBR_CDD
)
79 return cdd_Polyhedron_Reduced_Basis(P
, options
);
80 else if (options
->gbr_lp_solver
== BV_GBR_PIP
)
81 return pip_Polyhedron_Reduced_Basis(P
, options
);
82 else if (options
->gbr_lp_solver
== BV_GBR_PIP_DUAL
)
83 return pip_dual_Polyhedron_Reduced_Basis(P
, options
);
84 else if (options
->gbr_lp_solver
== BV_GBR_ISL
)
85 return isl_Polyhedron_Reduced_Basis(P
, options
);