66 context->inner_first = inner_first;
67 context->complex_first = complex_first;
120 #define DB_RESULT(e) \
123 fprintf(stderr, "[compare_the_constraints]\n"); \
124 vect_debug(v1); vect_debug(v2); \
125 fprintf(stderr, "%s\n", result==0 ? "=" : (result>0 ? ">" : "<")); \
129 #define RESULT(e) { return (e); }
131 #define RETURN_HARDER(b) RESULT(context->complex_first ? (b) : -(b))
132 #define RETURN_ORDER(b) RESULT(context->inner_first ? (b) : -(b))
134 #define same_sign_p(v,w) \
135 ((value_neg_p(v) && value_neg_p(w)) || (value_pos_p(v) && value_pos_p(w)))
147 Pvecteur v1 = (*pc1)->vecteur, v2 = (*pc2)->vecteur;
149 int i, irank = 0, cost_1, cost_2;
152 Pbase b, high = NULL;
181 if (irank == 0 && (!null_1 || !null_2))
182 val=val_1, val_p=val_2, irank=i, high=b;
253 for (*prank=-1,
rank=1, pb=b;
259 for (pv=v; pv!=NULL; pv=pv->
succ)
278 constraint_cmp_func_t compare,
288 if (nb_of_constraints<=1)
return c;
292 for (i=0; i<=nb_of_sort_vars; i++)
298 for (i=0, pc=c; pc!=NULL; i++, pc=pc->
succ)
309 (
int(*)(
const void *,
const void *,
void *)) compare,
314 for (i=0; i<nb_of_constraints-1; i++)
316 tc[i]->succ =
tc[i+1];
318 tc[nb_of_constraints-1]->succ=NULL;
330 constraint_cmp_func_t compare,
336 info = (two_int_infop)
malloc(
sizeof(two_int_info)*n);
430 if (ps->
nb_ineq > NB_INEQ_MAX1)
432 "[sc_triang_elim_redund] warning, %d inequalities\n",
450 for (ineq = ps->
inegalites; ineq != NULL; ineq = ineq1)
506 for (nth=*source; n>1; n--, nth=nth->
succ);
508 tmp = *target, *target = *source, *source = nth->
succ, nth->
succ = tmp;
528 for (ineq=sc_inegalites(s), tested=0, removed=0;
529 removed<n-1 && tested<n;
530 tested++, ineq=ineq->
succ)
551 if (s==NULL || sc_nbre_inegalites(s)==0)
return s;
553 info = (two_int_infop)
malloc(
sizeof(
int)*2*n);
568 n_other_constraints =
info[0][0]+
info[0][1];
569 old = sc_inegalites(s), sc_inegalites(s) = NULL, sc_nbre_inegalites(s) = 0;
572 sc_nbre_inegalites(s) = n_other_constraints;
582 for (side=0; side<=1; side++)
586 sc_nbre_inegalites(s)+=
info[
level][side];
#define value_notzero_p(val)
#define value_zero_p(val)
#define value_compare(v1, v2)
Pbase base_difference(Pbase b1, Pbase b2)
Pbase base_difference(Pbase b1, Pbase b2): allocate b; b = b1 - b2 – with the set meaning return b;.
Pbase base_normalize(Pbase b)
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
bdt base
Current expression.
void eq_set_vect_nul(Pcontrainte)
void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == ...
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
int level_contrainte(Pcontrainte, Pbase)
int level_contrainte(Pcontrainte pc, Pbase base_index) compute the level (rank) of the constraint pc ...
void contrainte_reverse(Pcontrainte)
void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e.
int vect_size(Pvecteur v)
package vecteur - reductions
static int tc
Internal variables
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Psysteme sc_kill_db_eg(Psysteme ps)
Psysteme sc_kill_db_eg(Psysteme ps): elimination des egalites et des inegalites identiques ou inutile...
Psysteme sc_elim_redund(Psysteme ps)
Psysteme sc_elim_redund(Psysteme ps): elimination des contraintes lineaires redondantes dans le syste...
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities)
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities): elimination des "fausses" contr...
bool sc_integer_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Psysteme sc_sort_constraints(Psysteme ps, Pbase base_index)
static void set_sort_context(sort_ctx_t *context, Pbase base, Pbase sort_base, bool inner_first, bool complex_first)
void sc_triang_elim_redund_n_first(Psysteme s, int n)
void sc_triang_elim_redund_n_first(s, n) Psysteme s; int n;
Pvecteur highest_rank_pvector(Pvecteur v, Pbase b, int *prank)
returns the highest rank pvector of v in b, of rank *prank
#define same_sign_p(v, w)
Pcontrainte contrainte_sort(Pcontrainte c, Pbase base, Pbase sort_base, bool inner_first, bool complex_first)
Psysteme sc_build_triang_elim_redund(Psysteme s, Pbase indexes)
outer to inner
static int compare_the_constraints(const Pcontrainte *pc1, const Pcontrainte *pc2, sort_ctx_t *context)
compare two constraints with a loop complexity cost in mind? not exactly, some of the choices attempt...
Pcontrainte constraints_sort_with_compare(Pcontrainte c, Pbase sort_base, constraint_cmp_func_t compare, void *context)
static int cost_of_constant_operations(Pvecteur v, sort_ctx_t *context)
Psysteme sc_sort_constraints_simplest_first(Psysteme ps, Pbase base_index)
static void clear_sort_context(sort_ctx_t *context)
Psysteme sc_triang_elim_redund(Psysteme ps, Pbase base_index)
sort contrainte c, base b, relatively to sort_base, as defined by the switches.
static Pcontrainte constraints_sort_info(Pcontrainte c, Pbase sort_base, constraint_cmp_func_t compare, void *context, two_int_infop info)
sorts the constraints according to the compare function, and set the number of constraints for each i...
void move_n_first_constraints(Pcontrainte *source, Pcontrainte *target, int n)
void move_n_first_constraints(source, target, n) Pcontrainte *source, *target; int n;
struct Scontrainte * succ
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
struct Svecteur * Pvecteur
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define BASE_NULLE
MACROS SUR LES BASES.
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...