00001 #ifndef ISL_TAB_H
00002 #define ISL_TAB_H
00003
00004 #include "isl_lp.h"
00005 #include "isl_map.h"
00006 #include "isl_mat.h"
00007
00008 struct isl_tab_var {
00009 int index;
00010 unsigned is_row : 1;
00011 unsigned is_nonneg : 1;
00012 unsigned is_zero : 1;
00013 unsigned is_redundant : 1;
00014 unsigned marked : 1;
00015 unsigned frozen : 1;
00016 };
00017
00018 enum isl_tab_undo_type {
00019 isl_tab_undo_bottom,
00020 isl_tab_undo_empty,
00021 isl_tab_undo_nonneg,
00022 isl_tab_undo_redundant,
00023 isl_tab_undo_zero,
00024 isl_tab_undo_allocate,
00025 isl_tab_undo_relax,
00026 };
00027
00028 struct isl_tab_undo {
00029 enum isl_tab_undo_type type;
00030 struct isl_tab_var *var;
00031 struct isl_tab_undo *next;
00032 };
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 struct isl_tab {
00072 struct isl_mat *mat;
00073
00074 unsigned n_row;
00075 unsigned n_col;
00076 unsigned n_dead;
00077 unsigned n_redundant;
00078
00079 unsigned n_var;
00080 unsigned n_con;
00081 unsigned n_eq;
00082 unsigned max_con;
00083 struct isl_tab_var *var;
00084 struct isl_tab_var *con;
00085 int *row_var;
00086 int *col_var;
00087
00088 struct isl_tab_undo bottom;
00089 struct isl_tab_undo *top;
00090
00091 unsigned need_undo : 1;
00092 unsigned rational : 1;
00093 unsigned empty : 1;
00094 };
00095
00096 void isl_tab_free(struct isl_ctx *ctx, struct isl_tab *tab);
00097
00098 struct isl_tab *isl_tab_from_basic_map(struct isl_basic_map *bmap);
00099 struct isl_tab *isl_tab_from_basic_set(struct isl_basic_set *bset);
00100 struct isl_tab *isl_tab_from_recession_cone(struct isl_basic_map *bmap);
00101 int isl_tab_cone_is_bounded(struct isl_ctx *ctx, struct isl_tab *tab);
00102 struct isl_basic_map *isl_basic_map_update_from_tab(struct isl_basic_map *bmap,
00103 struct isl_tab *tab);
00104 struct isl_basic_set *isl_basic_set_update_from_tab(struct isl_basic_set *bset,
00105 struct isl_tab *tab);
00106 struct isl_tab *isl_tab_detect_equalities(struct isl_ctx *ctx,
00107 struct isl_tab *tab);
00108 struct isl_tab *isl_tab_detect_redundant(struct isl_ctx *ctx,
00109 struct isl_tab *tab);
00110 enum isl_lp_result isl_tab_min(struct isl_ctx *ctx, struct isl_tab *tab,
00111 isl_int *f, isl_int denom, isl_int *opt, isl_int *opt_denom);
00112
00113 struct isl_tab *isl_tab_extend(struct isl_ctx *ctx, struct isl_tab *tab,
00114 unsigned n_new);
00115 struct isl_tab *isl_tab_add_ineq(struct isl_ctx *ctx,
00116 struct isl_tab *tab, isl_int *ineq);
00117
00118 int isl_tab_is_equality(struct isl_ctx *ctx, struct isl_tab *tab, int con);
00119 int isl_tab_is_redundant(struct isl_ctx *ctx, struct isl_tab *tab, int con);
00120
00121 struct isl_vec *isl_tab_get_sample_value(struct isl_ctx *ctx,
00122 struct isl_tab *tab);
00123
00124 enum isl_ineq_type {
00125 isl_ineq_error = -1,
00126 isl_ineq_redundant,
00127 isl_ineq_separate,
00128 isl_ineq_cut,
00129 isl_ineq_adj_eq,
00130 isl_ineq_adj_ineq,
00131 };
00132
00133 enum isl_ineq_type isl_tab_ineq_type(struct isl_ctx *ctx, struct isl_tab *tab,
00134 isl_int *ineq);
00135
00136 struct isl_tab_undo *isl_tab_snap(struct isl_ctx *ctx, struct isl_tab *tab);
00137 int isl_tab_rollback(struct isl_ctx *ctx, struct isl_tab *tab,
00138 struct isl_tab_undo *snap);
00139
00140 struct isl_tab *isl_tab_relax(struct isl_ctx *ctx,
00141 struct isl_tab *tab, int con);
00142 struct isl_tab *isl_tab_select_facet(struct isl_ctx *ctx,
00143 struct isl_tab *tab, int con);
00144
00145 void isl_tab_dump(struct isl_ctx *ctx, struct isl_tab *tab,
00146 FILE *out, int indent);
00147
00148 #endif