PIPS
unaires.c File Reference
#include <stdio.h>
#include "linear_assert.h"
#include <stdlib.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
+ Include dependency graph for unaires.c:

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...
 

Function Documentation

◆ constraints_for_bounds()

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

Parameters
varar
pinitinit
plowerlower
pupperupper

Definition at line 176 of file unaires.c.

179 {
180  Value
181  v;
183  c, next,
184  remain = NULL,
185  lower = NULL,
186  upper = NULL;
187 
188  for(c = *pinit, next=(c==NULL ? NULL : c->succ);
189  c!=NULL;
190  c=next, next=(c==NULL ? NULL : c->succ))
191  {
192  v = vect_coeff(var, c->vecteur);
193 
194  if (value_pos_p(v))
195  c->succ = upper, upper = c;
196  else if (value_neg_p(v))
197  c->succ = lower, lower = c;
198  else /* v==0 */
199  c->succ = remain, remain = c;
200  }
201 
202  *pinit = remain,
203  *plower = lower,
204  *pupper = upper;
205 }
#define value_pos_p(val)
int Value
#define value_neg_p(val)
Pvecteur vecteur
struct Scontrainte * succ
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ constraints_lexicographic_sort()

Pcontrainte constraints_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

For historical reasons, equal to equations_lexicographic_sort()

Parameters
cll

Definition at line 461 of file unaires.c.

463 {
465 
466  result = constraints_lexicographic_sort_generic(cl, compare, true);
467 
468  return result;
469 }
#define CONTRAINTE_UNDEFINED
Pcontrainte constraints_lexicographic_sort_generic(Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *), bool is_equation)
Definition: unaires.c:472

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

+ Here is the call graph for this function:

◆ constraints_lexicographic_sort_generic()

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

Parameters
cll
is_equations_equation

Definition at line 472 of file unaires.c.

475 {
476  int n = nb_elems_list(cl);
478  Pcontrainte * table = NULL;
479  Pcontrainte * elem = NULL;
480  Pcontrainte ce;
481 
482  if ( n==0 || n==1 )
483  return cl;
484 
485  lexicographic_compare = compare;
486 
487  /* the temporary table is created and initialized
488  */
489  table = (Pcontrainte*) malloc(sizeof(Pcontrainte)*n);
490  assert(table!=NULL);
491 
492  for (ce=cl, elem=table; ce!=CONTRAINTE_UNDEFINED; ce=ce->succ, elem++)
493  *elem=ce;
494 
495  /* sort!
496  */
497  if(is_equation)
498  qsort((char *) table, n, sizeof(Pcontrainte),
499  (int (*)()) internal_equation_compare);
500  else
501  qsort((char *) table, n, sizeof(Pcontrainte),
502  (int (*)()) internal_inequality_compare);
503 
504  /* the vector is regenerated in order
505  */
506  for (elem=table; n>1; elem++, n--)
507  (*elem)->succ=*(elem+1);
508 
509  (*elem)->succ= CONTRAINTE_UNDEFINED;
510 
511  /* clean and return
512  */
513  result = *table;
514  free(table);
515  return result;
516 }
static int internal_equation_compare(Pcontrainte *pc1, Pcontrainte *pc2)
Definition: unaires.c:408
static int internal_inequality_compare(Pcontrainte *pc1, Pcontrainte *pc2)
Definition: unaires.c:429
static int(* lexicographic_compare)(Pvecteur *, Pvecteur *)
Required because qsort (and C) do no let us parametrize the comparison function (no lambda closure).
Definition: unaires.c:392
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129
void * malloc(YYSIZE_T)
void free(void *)
#define assert(ex)
Definition: newgen_assert.h:41

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_chg_sgn()

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.

58 {
60 }
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_dup_extract()

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

Parameters
varar

Definition at line 215 of file unaires.c.

218 {
220  result = NULL,
221  pc, ctmp;
222 
223  for (pc=c; pc!=NULL; pc=pc->succ)
224  if ((var==NULL) || vect_coeff(var, pc->vecteur)!=0)
225  ctmp = contrainte_dup(pc),
226  ctmp->succ = result,
227  result = ctmp;
228 
229  return(result);
230 }
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132

References contrainte_dup(), Scontrainte::succ, and vect_coeff().

Referenced by algorithm_row_echelon_generic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_extract()

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

Parameters
pcc
basease
varar

Definition at line 242 of file unaires.c.

246 {
247  int
248  rank = rank_of_variable(base, var);
250  ctmp = NULL,
251  result = NULL,
252  cprev = NULL,
253  c = *pc;
254 
255  while (c!=NULL)
256  {
257  if (search_higher_rank(c->vecteur, base)==rank)
258  {
259  /*
260  * c must be extracted
261  */
262  ctmp = c->succ,
263  c->succ = result,
264  result = c,
265  c = ctmp;
266 
267  if (cprev==NULL)
268  *pc = ctmp;
269  else
270  cprev->succ=ctmp;
271  }
272  else
273  c=c->succ,
274  cprev=(cprev==NULL) ? *pc : cprev->succ;
275  }
276 
277  return(result);
278 }
int rank_of_variable(Pbase base, Variable var)
this function returns the rank of the variable var in the base 0 encodes TCST, but I do not know why,...
Definition: base.c:497
int search_higher_rank(Pvecteur vect, Pbase base)
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteu...
Definition: base.c:541
bdt base
Current expression.
Definition: bdt_read_paf.c:100
static entity rank

References base, rank, rank_of_variable(), search_higher_rank(), and Scontrainte::succ.

+ Here is the call graph for this function:

◆ contrainte_reverse()

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.

69 {
72 }
#define VALUE_ONE
void contrainte_chg_sgn(Pcontrainte c)
void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e.
Definition: unaires.c:56
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_simple_equality()

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.

522 {
523  Pvecteur v = e->vecteur;
524  int size = vect_size(v);
525  switch (size) {
526  case 0: return NULL;
527  case 1: if (v->var) return v->var; else return NULL;
528  case 2:
529  if (v->var && !v->succ->var) return v->var;
530  if (!v->var && v->succ->var) return v->succ->var;
531  }
532  return NULL;
533 }
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92

References Svecteur::succ, Svecteur::var, vect_size(), and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ contrainte_translate()

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.

103 {
104  if(!CONTRAINTE_UNDEFINED_P(c))
106  variable_name);
107 
108  return c;
109 }
Pvecteur vect_translate(Pvecteur v, Pbase b, char *(*variable_name)(Variable))
Pvecteur vect_translate(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its ...
Definition: base.c:313
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
char * variable_name(Variable v)
polynome_ri.c
Definition: polynome_ri.c:73

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, variable_name(), and vect_translate().

+ Here is the call graph for this function:

◆ contrainte_var_min_coeff()

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.

Parameters
contraintesontraintes
coeffoeff
rm_if_not_first_pm_if_not_first_p

Definition at line 345 of file unaires.c.

350 {
351  Value sc = VALUE_ZERO, cv = VALUE_ZERO;
352  Pcontrainte result, eq, pred, eq1;
353 
354  if (contraintes == NULL)
355  return(NULL);
356 
357  result = pred = eq1 = NULL;
358 
359  for (eq = contraintes; eq != NULL; eq = eq->succ) {
360  Value c, ca;
361  c = vect_coeff(v, eq->vecteur);
362  ca = value_abs(c);
363  if ((value_lt(ca,cv) && value_pos_p(ca)) ||
364  (value_zero_p(cv) && value_notzero_p(c))) {
365  cv = ca;
366  sc = c;
367  result = eq;
368  pred = eq1;
369  }
370  }
371 
372  if (value_neg_p(sc))
373  contrainte_chg_sgn(result);
374 
375  if (rm_if_not_first_p && pred != NULL) {
376  pred->succ = result->succ;
377  result->succ = NULL;
378  }
379 
380  *coeff = cv;
381  return result;
382 }
#define VALUE_ZERO
#define value_notzero_p(val)
#define value_zero_p(val)
#define value_abs(val)
#define value_lt(v1, v2)
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_variable_rename()

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.

Parameters
v_old_old
v_new_new

Definition at line 115 of file unaires.c.

119 {
120  if(!CONTRAINTE_UNDEFINED_P(c))
122  v_old, v_new);
123 
124  return c;
125 }
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new)
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new): rename the potential coord...
Definition: base.c:366

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, and vect_variable_rename().

Referenced by sc_variable_rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contrainte_vect_sort()

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.

326 {
327  for (; c!=NULL; c=c->succ)
328  vect_sort_in_place(&c->vecteur, compare);
329 }
void vect_sort_in_place(Pvecteur *pv, int *compare)
void vect_sort_in_place(pv, compare) Pvecteur *pv; int (*compare)(Pvecteur *, Pvecteur *);
Definition: unaires.c:290

References Scontrainte::succ, vect_sort_in_place(), and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ eq_set_vect_nul()

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.

86 {
87  if(!CONTRAINTE_UNDEFINED_P(c)) {
90  }
91 }
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equation_lexicographic_compare()

int equation_lexicographic_compare ( Pcontrainte  c1,
Pcontrainte  c2,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

it is assumed that constraints c1 and c2 are already lexicographically sorted

Parameters
c11
c22

Definition at line 395 of file unaires.c.

397 {
398  /* it is assumed that constraints c1 and c2 are already
399  lexicographically sorted */
400  int cmp = 0;
401 
402  cmp = vect_lexicographic_compare(c1->vecteur, c2->vecteur, compare);
403 
404  return cmp;
405 }
int vect_lexicographic_compare(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
qsort() is not safe if the comparison function is not antisymmetric.
Definition: unaires.c:433

References vect_lexicographic_compare(), and Scontrainte::vecteur.

Referenced by internal_equation_compare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equations_lexicographic_sort()

Pcontrainte equations_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)
Parameters
cll

Definition at line 438 of file unaires.c.

440 {
442 
443  result = constraints_lexicographic_sort_generic(cl, compare, true);
444 
445  return result;
446 }

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

Referenced by sc_lexicographic_sort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inequalities_lexicographic_sort()

Pcontrainte inequalities_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)
Parameters
cll

Definition at line 449 of file unaires.c.

451 {
453 
454  result = constraints_lexicographic_sort_generic(cl, compare, false);
455 
456  return result;
457 }

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

Referenced by sc_lexicographic_sort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inequality_lexicographic_compare()

int inequality_lexicographic_compare ( Pcontrainte  c1,
Pcontrainte  c2,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

it is assumed that constraints c1 and c2 are already lexicographically sorted

Parameters
c11
c22

Definition at line 416 of file unaires.c.

418 {
419  /* it is assumed that constraints c1 and c2 are already
420  lexicographically sorted */
421  int cmp = 0;
422 
423  cmp = vect_lexicographic_compare2(c1->vecteur, c2->vecteur, compare);
424 
425  return cmp;
426 }
int vect_lexicographic_compare2(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
Version for inequalities.
Definition: unaires.c:449

References vect_lexicographic_compare2(), and Scontrainte::vecteur.

Referenced by internal_inequality_compare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ internal_equation_compare()

static int internal_equation_compare ( Pcontrainte pc1,
Pcontrainte pc2 
)
static

Definition at line 408 of file unaires.c.

409 {
410  int cmp = equation_lexicographic_compare(*pc1, *pc2,
412  return cmp;
413 }
int equation_lexicographic_compare(Pcontrainte c1, Pcontrainte c2, int(*compare)(Pvecteur *, Pvecteur *))
Definition: unaires.c:395

References equation_lexicographic_compare(), and lexicographic_compare.

Referenced by constraints_lexicographic_sort_generic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ internal_inequality_compare()

static int internal_inequality_compare ( Pcontrainte pc1,
Pcontrainte pc2 
)
static

Definition at line 429 of file unaires.c.

430 {
431  int cmp = inequality_lexicographic_compare(*pc1, *pc2,
433  return cmp;
434 }
int inequality_lexicographic_compare(Pcontrainte c1, Pcontrainte c2, int(*compare)(Pvecteur *, Pvecteur *))
Definition: unaires.c:416

References inequality_lexicographic_compare(), and lexicographic_compare.

Referenced by constraints_lexicographic_sort_generic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ level_contrainte()

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

Parameters
pcc
base_indexase_index

Definition at line 292 of file unaires.c.

295 {
296  Pvecteur pv;
297  Pbase pb;
298  int level = 0;
299  int i;
300  int sign=1;
301  bool trouve = false;
302 
303  for (pv = pc->vecteur;
304  pv!=NULL;
305  pv = pv->succ)
306  {
307  for (i=1, trouve=false, pb=base_index;
308  pb!=NULL && !trouve;
309  i++, pb=pb->succ)
310  if (pv->var == pb->var)
311  {
312  trouve = true;
313  if (i>level)
314  level = i, sign = value_sign(pv->val);
315  }
316  }
317  return(sign*level);
318 }
#define value_sign(v)
trian operators on values
#define level
Value val
Definition: vecteur-local.h:91

References level, Svecteur::succ, Svecteur::val, value_sign, and Svecteur::var.

Referenced by make_bound_expression(), and sc_triang_elim_redund().

+ Here is the caller graph for this function:

◆ norm_eq()

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

Parameters
nrr

Definition at line 44 of file unaires.c.

46 {
48 }
void vect_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...
Definition: unaires.c:59

References vect_normalize().

Referenced by norm_syst().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Pcontrainte_separate_on_vars()

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

Parameters
initialnitial
varsars
pwithwith
pwithoutwithout

Definition at line 140 of file unaires.c.

144 {
146  c = (Pcontrainte) NULL,
147  new = CONTRAINTE_UNDEFINED;
148 
149  for(c=initial,
150  *pwith=(Pcontrainte)NULL,
151  *pwithout=(Pcontrainte)NULL;
152  c!=(Pcontrainte) NULL;
153  c=c->succ)
154  if (constraint_without_vars(c, vars))
155  new = contrainte_make(vect_dup(c->vecteur)),
156  new->succ = *pwithout,
157  *pwithout = new;
158  else
159  new = contrainte_make(vect_dup(c->vecteur)),
160  new->succ = *pwith,
161  *pwith = new;
162 }
struct Scontrainte * Pcontrainte
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
bool constraint_without_vars(Pcontrainte, Pbase)
bool constraint_without_vars(c, vars) Pcontrainte c; Pbase vars;
Definition: predicats.c:276
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ lexicographic_compare

int(* lexicographic_compare) (Pvecteur *, Pvecteur *) ( Pvecteur ,
Pvecteur  
) = NULL
static

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().