PIPS
|
#include <stdio.h>
#include "linear_assert.h"
#include <stdlib.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
Go to the source code of this file.
Functions | |
void | norm_eq (Pcontrainte nr) |
PACKAGE CONTRAINTE - OPERATIONS UNAIRES. More... | |
void | contrainte_chg_sgn (Pcontrainte c) |
void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e. More... | |
void | contrainte_reverse (Pcontrainte c) |
void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e. More... | |
void | eq_set_vect_nul (Pcontrainte c) |
void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == 0 More... | |
Pcontrainte | contrainte_translate (Pcontrainte c, Pbase b, char *(*variable_name)()) |
Pcontrainte contrainte_translate(Pcontrainte c, Pbase b, char * (*variable_name)()): normalisation des vecteurs de base utilises dans c par rapport a la base b utilisant les "noms" des vecteurs de base; en sortie tous les vecteurs de base utilises dans c appartiennent a b;. More... | |
Pcontrainte | contrainte_variable_rename (Pcontrainte c, Variable v_old, Variable v_new) |
Pcontrainte contrainte_variable_rename(Pcontrainte c, Variable v_old, Variable v_new): rename the potential coordinate v_old in c as v_new. More... | |
void | Pcontrainte_separate_on_vars (Pcontrainte initial, Pbase vars, Pcontrainte *pwith, Pcontrainte *pwithout) |
void Pcontrainte_separate_on_vars(initial, vars, pwith, pwithout) Pcontrainte initial; Pbase vars; Pcontrainte *pwith, *pwithout; More... | |
void | constraints_for_bounds (Variable var, Pcontrainte *pinit, Pcontrainte *plower, Pcontrainte *pupper) |
void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit, *plower, *pupper; IN: var, *pinit; OUT: *pinit, *plower, *pupper; More... | |
Pcontrainte | contrainte_dup_extract (Pcontrainte c, Variable var) |
Pcontrainte contrainte_dup_extract(c, var) Pcontrainte c; Variable var;. More... | |
Pcontrainte | contrainte_extract (Pcontrainte *pc, Pbase base, Variable var) |
Pcontrainte contrainte_extract(pc, base, var) Pcontrainte *pc; Pbase base; Variable var;. More... | |
int | level_contrainte (Pcontrainte pc, Pbase base_index) |
int level_contrainte(Pcontrainte pc, Pbase base_index) compute the level (rank) of the constraint pc in the nested loops. More... | |
void | contrainte_vect_sort (Pcontrainte c, int *compare) |
it sorts the vectors as expected. More... | |
Pcontrainte | contrainte_var_min_coeff (Pcontrainte contraintes, Variable v, Value *coeff, bool rm_if_not_first_p) |
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list of constraints (euqalities or inequalities), a variable, and the location of an integer. More... | |
int | equation_lexicographic_compare (Pcontrainte c1, Pcontrainte c2, int(*compare)(Pvecteur *, Pvecteur *)) |
static int | internal_equation_compare (Pcontrainte *pc1, Pcontrainte *pc2) |
int | inequality_lexicographic_compare (Pcontrainte c1, Pcontrainte c2, int(*compare)(Pvecteur *, Pvecteur *)) |
static int | internal_inequality_compare (Pcontrainte *pc1, Pcontrainte *pc2) |
Pcontrainte | equations_lexicographic_sort (Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *)) |
Pcontrainte | inequalities_lexicographic_sort (Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *)) |
Pcontrainte | constraints_lexicographic_sort (Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *)) |
For historical reasons, equal to equations_lexicographic_sort() More... | |
Pcontrainte | constraints_lexicographic_sort_generic (Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *), bool is_equation) |
Variable | contrainte_simple_equality (Pcontrainte e) |
returns whether a constraint is a simple equality: X == 12 the system is expected to be normalized? More... | |
Variables | |
static int(* | lexicographic_compare )(Pvecteur *, Pvecteur *) = NULL |
Required because qsort (and C) do no let us parametrize the comparison function (no lambda closure). More... | |
void constraints_for_bounds | ( | Variable | var, |
Pcontrainte * | pinit, | ||
Pcontrainte * | plower, | ||
Pcontrainte * | pupper | ||
) |
void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit, *plower, *pupper; IN: var, *pinit; OUT: *pinit, *plower, *pupper;
separate the constraints involving var for upper and lower bounds The constraints are removed from the original system. everything is touched. Should be fast because there is no allocation.
FC 28/11/94
v==0
var | ar |
pinit | init |
plower | lower |
pupper | upper |
Definition at line 176 of file unaires.c.
References Scontrainte::succ, value_neg_p, value_pos_p, vect_coeff(), and Scontrainte::vecteur.
Referenced by do_array_expansion(), do_check_isolate_statement_preconditions_on_call(), do_isolate_statement_preconditions_satisified_p(), do_solve_hardware_constraints_on_nb_proc(), make_rectangular_area(), region_to_minimal_dimensions(), statement_insertion_fix_access(), systeme_to_loop_nest(), and variable_to_dimensions().
Pcontrainte constraints_lexicographic_sort | ( | Pcontrainte | cl, |
int(*)(Pvecteur *, Pvecteur *) | compare | ||
) |
For historical reasons, equal to equations_lexicographic_sort()
cl | l |
Definition at line 461 of file unaires.c.
References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.
Pcontrainte constraints_lexicographic_sort_generic | ( | Pcontrainte | cl, |
int(*)(Pvecteur *, Pvecteur *) | compare, | ||
bool | is_equation | ||
) |
the temporary table is created and initialized
sort!
the vector is regenerated in order
clean and return
cl | l |
is_equation | s_equation |
Definition at line 472 of file unaires.c.
References assert, CONTRAINTE_UNDEFINED, free(), internal_equation_compare(), internal_inequality_compare(), lexicographic_compare, malloc(), nb_elems_list(), and Scontrainte::succ.
Referenced by constraints_lexicographic_sort(), equations_lexicographic_sort(), and inequalities_lexicographic_sort().
void contrainte_chg_sgn | ( | Pcontrainte | c | ) |
void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e.
multiplication par -1. Les equations ne sont pas modifiees mais les inequations sont transformees.
Ancien nom: ch_sgn
Definition at line 56 of file unaires.c.
References vect_chg_sgn().
Referenced by contrainte_reverse(), contrainte_var_min_coeff(), eq_redund_with_sc_p(), make_tile_constraints(), sc_supress_same_constraints(), and tile_membership().
Pcontrainte contrainte_dup_extract | ( | Pcontrainte | c, |
Variable | var | ||
) |
Pcontrainte contrainte_dup_extract(c, var) Pcontrainte c; Variable var;.
returns a copy of the constraints of c which contain var.
FC 27/09/94
var | ar |
Definition at line 215 of file unaires.c.
References contrainte_dup(), Scontrainte::succ, and vect_coeff().
Referenced by algorithm_row_echelon_generic().
Pcontrainte contrainte_extract | ( | Pcontrainte * | pc, |
Pbase | base, | ||
Variable | var | ||
) |
Pcontrainte contrainte_extract(pc, base, var) Pcontrainte *pc; Pbase base; Variable var;.
returns the constraints of *pc of which the higher rank variable from base is var. These constraints are removed from *pc.
FC 27/09/94
pc | c |
base | ase |
var | ar |
Definition at line 242 of file unaires.c.
References base, rank, rank_of_variable(), search_higher_rank(), and Scontrainte::succ.
void contrainte_reverse | ( | Pcontrainte | c | ) |
void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e.
multiplication par -1, et ajout de la constante 1.
Definition at line 67 of file unaires.c.
References contrainte_chg_sgn(), TCST, VALUE_ONE, and vect_add_elem().
Referenced by build_integer_sc_nredund(), build_sc_nredund_1pass_ofl_ctrl(), ineq_redund_with_sc_p(), sc_elim_redund_with_first_ofl_ctrl(), sc_inequations_elim_redund(), sc_triang_elim_redund(), and sc_triang_elim_redund_n_first().
Variable contrainte_simple_equality | ( | Pcontrainte | e | ) |
returns whether a constraint is a simple equality: X == 12 the system is expected to be normalized?
Definition at line 521 of file unaires.c.
References Svecteur::succ, Svecteur::var, vect_size(), and Scontrainte::vecteur.
Pcontrainte contrainte_translate | ( | Pcontrainte | c, |
Pbase | b, | ||
char * (*)() | variable_name | ||
) |
Pcontrainte contrainte_translate(Pcontrainte c, Pbase b, char * (*variable_name)()): normalisation des vecteurs de base utilises dans c par rapport a la base b utilisant les "noms" des vecteurs de base; en sortie tous les vecteurs de base utilises dans c appartiennent a b;.
Definition at line 99 of file unaires.c.
References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, variable_name(), and vect_translate().
Pcontrainte contrainte_var_min_coeff | ( | Pcontrainte | contraintes, |
Variable | v, | ||
Value * | coeff, | ||
bool | rm_if_not_first_p | ||
) |
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list of constraints (euqalities or inequalities), a variable, and the location of an integer.
output : the constraint in "contraintes" where the coefficient of "v" is the smallest (but non-zero). modifies : nothing. comment : the returned constraint is not removed from the list if rm_if_not_first_p is false. if rm_if_not_first_p is true, the returned contraint is remove only if it is not the first constraint.
contraintes | ontraintes |
coeff | oeff |
rm_if_not_first_p | m_if_not_first_p |
Definition at line 345 of file unaires.c.
References contrainte_chg_sgn(), eq, Scontrainte::succ, value_abs, value_lt, value_neg_p, value_notzero_p, value_pos_p, VALUE_ZERO, value_zero_p, vect_coeff(), and Scontrainte::vecteur.
Referenced by better_elim_var_with_eg(), new_elim_var_with_eg(), remove_variables_if_possible(), and sc_projection_optim_along_vecteur_ofl().
Pcontrainte contrainte_variable_rename | ( | Pcontrainte | c, |
Variable | v_old, | ||
Variable | v_new | ||
) |
Pcontrainte contrainte_variable_rename(Pcontrainte c, Variable v_old, Variable v_new): rename the potential coordinate v_old in c as v_new.
v_old | _old |
v_new | _new |
Definition at line 115 of file unaires.c.
References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, and vect_variable_rename().
Referenced by sc_variable_rename().
void contrainte_vect_sort | ( | Pcontrainte | c, |
int * | compare | ||
) |
it sorts the vectors as expected.
FC 24/11/94
Definition at line 323 of file unaires.c.
References Scontrainte::succ, vect_sort_in_place(), and Scontrainte::vecteur.
void eq_set_vect_nul | ( | Pcontrainte | c | ) |
void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == 0
cette fonction est utile lorsque l'on veut eliminer plusieurs
contraintes du systeme sans avoir a le restructurer apres chaque
elimination.
Pour eliminer toutes ces "fausses" contraintes on utilise a la fin la
fonction "syst_elim_eq" (ou "sc_rm_empty_constraints"...)
Definition at line 84 of file unaires.c.
References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, vect_rm(), and VECTEUR_NUL.
Referenced by elim_redund_sc_with_sc(), sc_bounded_normalization(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_elim_simple_redund_with_eq(), sc_elim_simple_redund_with_ineq(), sc_inequations_elim_redund(), sc_kill_db_eg(), sc_safe_elim_db_constraints(), sc_safe_kill_db_eg(), sc_strong_normalize_and_check_feasibility(), sc_transform_ineg_in_eg(), sc_triang_elim_redund(), sc_triang_elim_redund_n_first(), simplify_big_coeff(), and sys_int_redond().
int equation_lexicographic_compare | ( | Pcontrainte | c1, |
Pcontrainte | c2, | ||
int(*)(Pvecteur *, Pvecteur *) | compare | ||
) |
it is assumed that constraints c1 and c2 are already lexicographically sorted
c1 | 1 |
c2 | 2 |
Definition at line 395 of file unaires.c.
References vect_lexicographic_compare(), and Scontrainte::vecteur.
Referenced by internal_equation_compare().
Pcontrainte equations_lexicographic_sort | ( | Pcontrainte | cl, |
int(*)(Pvecteur *, Pvecteur *) | compare | ||
) |
cl | l |
Definition at line 438 of file unaires.c.
References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.
Referenced by sc_lexicographic_sort().
Pcontrainte inequalities_lexicographic_sort | ( | Pcontrainte | cl, |
int(*)(Pvecteur *, Pvecteur *) | compare | ||
) |
cl | l |
Definition at line 449 of file unaires.c.
References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.
Referenced by sc_lexicographic_sort().
int inequality_lexicographic_compare | ( | Pcontrainte | c1, |
Pcontrainte | c2, | ||
int(*)(Pvecteur *, Pvecteur *) | compare | ||
) |
it is assumed that constraints c1 and c2 are already lexicographically sorted
c1 | 1 |
c2 | 2 |
Definition at line 416 of file unaires.c.
References vect_lexicographic_compare2(), and Scontrainte::vecteur.
Referenced by internal_inequality_compare().
|
static |
Definition at line 408 of file unaires.c.
References equation_lexicographic_compare(), and lexicographic_compare.
Referenced by constraints_lexicographic_sort_generic().
|
static |
Definition at line 429 of file unaires.c.
References inequality_lexicographic_compare(), and lexicographic_compare.
Referenced by constraints_lexicographic_sort_generic().
int level_contrainte | ( | Pcontrainte | pc, |
Pbase | base_index | ||
) |
int level_contrainte(Pcontrainte pc, Pbase base_index) compute the level (rank) of the constraint pc in the nested loops.
base_index is the index basis in the good order The result corresponds to the rank of the greatest index in the constraint, and the sign of the result corresponds to the sign of the coefficient of this index
For instance: base_index :I->J->K , I - J <=0 ==> level -2 I + J + K <=0 ==> level +3
pc | c |
base_index | ase_index |
Definition at line 292 of file unaires.c.
References level, Svecteur::succ, Svecteur::val, value_sign, and Svecteur::var.
Referenced by make_bound_expression(), and sc_triang_elim_redund().
void norm_eq | ( | Pcontrainte | nr | ) |
PACKAGE CONTRAINTE - OPERATIONS UNAIRES.
unaires.c
norm_eq: normalisation d'une contrainte par le pgcd de TOUS les coefficients, i.e. y compris le terme constant
nr | r |
Definition at line 44 of file unaires.c.
References vect_normalize().
Referenced by norm_syst().
void Pcontrainte_separate_on_vars | ( | Pcontrainte | initial, |
Pbase | vars, | ||
Pcontrainte * | pwith, | ||
Pcontrainte * | pwithout | ||
) |
void Pcontrainte_separate_on_vars(initial, vars, pwith, pwithout) Pcontrainte initial; Pbase vars; Pcontrainte *pwith, *pwithout;
IN: initial, vars
OUT: pwith, pwithout
builds two Pcontraintes from the one given, using the constraint_without_vars criterium.
(c) FC 16/05/94
initial | nitial |
vars | ars |
pwith | with |
pwithout | without |
Definition at line 140 of file unaires.c.
References constraint_without_vars(), contrainte_make(), CONTRAINTE_UNDEFINED, Scontrainte::succ, vect_dup(), and Scontrainte::vecteur.
Referenced by get_other_constraints(), and sc_separate_on_vars().
Required because qsort (and C) do no let us parametrize the comparison function (no lambda closure).
Definition at line 392 of file unaires.c.
Referenced by constraints_lexicographic_sort_generic(), internal_equation_compare(), and internal_inequality_compare().