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

Go to the source code of this file.

Functions

int vect_size (Pvecteur v)
 package vecteur - reductions More...
 
int vect_dimension (Pvecteur v)
 int vect_dimension(Pvecteur v): calcul du nombre de composantes non nulles et non constantes d'un vecteur More...
 
Value vect_prod_scal (Pvecteur v1, Pvecteur v2)
 Value vect_prod_scal(v1,v2): produit scalaire de v1 et de v2. More...
 
Value vect_pgcd_all (Pvecteur v)
 Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v. More...
 
Value vect_pgcd_except (Pvecteur v, Variable var)
 Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'un vecteur v, sauf le coefficient correspondant a la variable var. More...
 
Value vect_max0 (Pvecteur v)
 Value vect_max0(Pvecteur v): recherche du coefficient maximum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs. More...
 
Value vect_min0 (Pvecteur v)
 Value vect_min0(Pvecteur v): recherche du coefficient minimum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs. More...
 
Value vect_min (Pvecteur v)
 Value vect_min(Pvecteur v): recherche du coefficient non nul minimum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini. More...
 
Value vect_max (Pvecteur v)
 Value vect_max(Pvecteur v): recherche du coefficient non nul maximum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini. More...
 
Value vect_sum (Pvecteur v)
 Value vect_sum(Pvecteur v): somme des coefficients d'un vecteur (i.e. More...
 
bool vect_equal (Pvecteur v1, Pvecteur v2)
 bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs More...
 
bool vect_equal_except (Pvecteur v1, Pvecteur v2, Variable var)
 bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 . More...
 
bool vect_oppos (Pvecteur v1, Pvecteur v2)
 bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs More...
 
bool vect_opposite_except (Pvecteur v1, Pvecteur v2, Variable var)
 bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 . More...
 
int vect_proport (Pvecteur v1, Pvecteur v2)
 int vect_proport(Pvecteur v1, Pvecteur v2): test de la colinearite de deux vecteurs et de leur direction. More...
 
bool vect_colin_base (Pvecteur vec, Variable var)
 bool vect_colin_base(Pvecteur vec, Variable var): renvoie true si --> --> vec = k var More...
 
bool vect_check (Pvecteur cv)
 bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du package; aucun des coefficients effectivement conserves en memoire ne doit etre nul (la cellule aurait du etre liberee) et aucune dimension (i.e. More...
 
bool vect_consistent_p (Pvecteur v)
 To ease retrieval of vect_check() More...
 
bool vect_larger_coef_p (Pvecteur v, Value val)
 

Function Documentation

◆ vect_check()

bool vect_check ( Pvecteur  cv)

bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du package; aucun des coefficients effectivement conserves en memoire ne doit etre nul (la cellule aurait du etre liberee) et aucune dimension (i.e.

variable) ne peut apparaitre deux fois.

Ces conditions ne sont pas verifiees par Corinne dans ses routines du package "sommet".

new version to test linear_hashtable. better for large vectors, but much worse for small ones I guess. FC.

Especially for the NULL vector. FI.

Parameters
cvv

Definition at line 529 of file reductions.c.

530 {
531  Pvecteur v = cv;
532  register bool
533  consistent = true,
534  tcst_seen = false;
536 
537  for(; v!=NULL && consistent; v=v->succ)
538  {
539  consistent = value_notzero_p(val_of(v));
540  if (var_of(v))
541  {
543  consistent = false;
544  linear_hashtable_put(seen, var_of(v), (void*) 1);
545  }
546  else {
547  if (tcst_seen) consistent = false;
548  tcst_seen = true;
549  }
550  }
551 
553  return consistent;
554 }
static hash_table seen
static function to store whether a module has been seen during the recursive generation of the daVinc...
Definition: graph.c:85
#define value_notzero_p(val)
bool linear_hashtable_isin(linear_hashtable_pt h, void *k)
Definition: hashpointer.c:273
void linear_hashtable_put(linear_hashtable_pt h, void *k, void *v)
Definition: hashpointer.c:263
linear_hashtable_pt linear_hashtable_make(void)
constructor.
Definition: hashpointer.c:165
void linear_hashtable_free(linear_hashtable_pt h)
destructor
Definition: hashpointer.c:189
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
hidden structure to store the hashtable.
Definition: hashpointer.c:66
#define val_of(varval)
#define var_of(varval)

References linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put(), seen, Svecteur::succ, val_of, value_notzero_p, and var_of.

Referenced by adg_contrainte_fprint(), base_normalized_p(), contrainte_fprint(), contrainte_sprint_format(), contrainte_text_format(), monome_check(), pu_contrainte_fprint(), and vect_consistent_p().

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

◆ vect_colin_base()

bool vect_colin_base ( Pvecteur  vec,
Variable  var 
)

bool vect_colin_base(Pvecteur vec, Variable var): renvoie true si --> --> vec = k var

false sinon

Attention: le vecteur nul est colineaire a tous les vecteurs de base

Parameters
vecec
varar

Definition at line 508 of file reductions.c.

511 {
512  return(vec==NULL || (vec->succ==NULL && var_of(vec)==var));
513 }

References var_of.

◆ vect_consistent_p()

bool vect_consistent_p ( Pvecteur  v)

To ease retrieval of vect_check()

Definition at line 557 of file reductions.c.

557 { return vect_check(v);}
bool vect_check(Pvecteur cv)
bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du pac...
Definition: reductions.c:529

References vect_check().

+ Here is the call graph for this function:

◆ vect_dimension()

int vect_dimension ( Pvecteur  v)

int vect_dimension(Pvecteur v): calcul du nombre de composantes non nulles et non constantes d'un vecteur

sum abs(sgn(v[i])) i

Definition at line 64 of file reductions.c.

66 {
67  Pvecteur el;
68  int nb_elem = 0;
69 
70  for (el=v; el != NULL; el=el->succ)
71  if(!term_cst(el))
72  nb_elem++;
73 
74  return (nb_elem);
75 }
#define term_cst(varval)

References Svecteur::succ, and term_cst.

Referenced by choose_pattern(), find_pattern(), print_call_precondition(), sc_minmax_of_variable2(), sc_strong_normalize_and_check_feasibility2(), and xml_Pattern_Paving().

+ Here is the caller graph for this function:

◆ vect_equal()

bool vect_equal ( Pvecteur  v1,
Pvecteur  v2 
)

bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs

   ->    ->

return v1 == v2 ;

Note: le test n'est pas optimal puisque v2 est parcouru et compare a v1 meme si ces coefficients ont ete deja ete compare lors du parcours de v1; mais cela evite le "marquage" des coefficients vus;

shorter version, FC 28/09/94

v1 must be preserved for the second loop: use v

now v2 may be lost: use v2

Parameters
v11
v22

Definition at line 278 of file reductions.c.

280 {
281  /* Note: le test n'est pas optimal puisque v2 est parcouru et compare
282  * a v1 meme si ces coefficients ont ete deja ete compare lors du
283  * parcours de v1; mais cela evite le "marquage" des coefficients vus;
284  *
285  * shorter version, FC 28/09/94
286  */
287  Pvecteur v;
288  register bool
289  result = true;
290 
291  if (!v1 || !v2)
292  return(!v1 && !v2);
293 
294  /* v1 must be preserved for the second loop: use v
295  */
296  for (v=v1;
297  v && result;
298  v=v->succ)
299  result = value_eq(val_of(v),vect_coeff(var_of(v),v2));
300 
301  /* now v2 may be lost: use v2
302  */
303  for (;
304  v2 && result;
305  v2=v2->succ)
306  result = value_eq(val_of(v2),vect_coeff(var_of(v2),v1));
307 
308  return result;
309 }
#define value_eq(v1, v2)
bool operators on values
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 Svecteur::succ, val_of, value_eq, var_of, and vect_coeff().

Referenced by adg_quast_leaf_solution_equal_p(), adg_suppress_2nd_in_1st_ps(), call_rwt(), contrainte_equal(), contrainte_in_liste(), dte_in_sg_p(), egaliste_rd(), egalite_equal(), egalite_in_liste(), exp_equals_p(), free_guards(), monome_colin(), monome_equal(), polynome_constant_p(), polynome_TCST(), ray_in_sg_p(), rd_in_liste(), same_expression_p(), semantics_is_inferior_pvarval(), som_in_liste(), sommet_egal(), sommet_in_sg_p(), suppress_sc_in_sc(), and vect_lexicographic_unsafe_compare_generic().

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

◆ vect_equal_except()

bool vect_equal_except ( Pvecteur  v1,
Pvecteur  v2,
Variable  var 
)

bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 .

e> == <v2 . e>; e!=var

Parameters
v11
v22
varar

Definition at line 319 of file reductions.c.

322 {
323  Pvecteur pv;
324  /*
325  * Note: le test n'est pas optimal puisque v2 est parcouru et compare
326  * a v1 meme si ces coefficients ont ete deja ete compare lors du
327  * parcours de v1; mais cela evite le "marquage" des coefficients vus;
328  */
329  bool result;
330 
331  if(v1==NULL && v2==NULL)
332  result = true;
333  else if(v1==NULL)
334  result = v2->succ==NULL && var_of(v2)==var;
335  else if(v2 == NULL)
336  result = v1->succ==NULL && var_of(v1)==var;
337  else {
338  result = true;
339 
340  for (pv = v1; pv != NULL && result == true; pv = pv->succ)
341  if (var_of(pv) != var)
342  result = value_eq(val_of(pv),vect_coeff(var_of(pv), v2));
343 
344  for (pv = v2; pv != NULL && result == true; pv = pv->succ)
345  if (var_of(pv) != var)
346  result = value_eq(val_of(pv),vect_coeff(var_of(pv), v1));
347 
348  }
349 
350  return result;
351 }

References Svecteur::succ, val_of, value_eq, var_of, and vect_coeff().

Referenced by eq_smg(), and sc_elim_double_constraints().

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

◆ vect_larger_coef_p()

bool vect_larger_coef_p ( Pvecteur  v,
Value  val 
)
Returns
whether one coef in v is greater than abs(val), but CST
Parameters
vvecteur being scanned
valmaximum absolute value allowed, or 0 to ignore
Parameters
valal

Definition at line 564 of file reductions.c.

565 {
566  linear_assert("positive value", value_posz_p(val));
567  if (value_zero_p(val)) return false;
568  for (; v!=NULL; v=v->succ)
569  if (var_of(v) &&
570  (value_lt(val_of(v), value_uminus(val)) || value_gt(val_of(v), val)))
571  return true;
572  return false;
573 }
#define value_gt(v1, v2)
#define value_uminus(val)
unary operators on values
#define value_zero_p(val)
#define value_lt(v1, v2)
#define value_posz_p(val)
#define linear_assert(msg, ex)
Definition: linear_assert.h:51

References linear_assert, Svecteur::succ, val_of, value_gt, value_lt, value_posz_p, value_uminus, value_zero_p, and var_of.

Referenced by contrainte_remove_large_coef().

+ Here is the caller graph for this function:

◆ vect_max()

Value vect_max ( Pvecteur  v)

Value vect_max(Pvecteur v): recherche du coefficient non nul maximum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini.

max v[i] i v[i]!=0

Note: changement de semantique puisque 0 etait renvoye auparavant pour le vecteur 0

Modifications:

Definition at line 240 of file reductions.c.

242 {
243  if(v!=NULL) {
244  Value max = val_of(v);
245  for (v=v->succ; v!= NULL; v= v->succ)
246  max = value_max(val_of(v), max);
247  return max;
248  }
249  else {
250  vect_error("vect_max","ill. null vector as argument\n");
251  return VALUE_NAN;
252  }
253 }
int Value
#define value_max(v1, v2)
#define VALUE_NAN
#define max(a, b)
void vect_error(char *name, char *fmt,...)
package vecteur
Definition: error.c:50

References max, val_of, value_max, VALUE_NAN, and vect_error().

+ Here is the call graph for this function:

◆ vect_max0()

Value vect_max0 ( Pvecteur  v)

Value vect_max0(Pvecteur v): recherche du coefficient maximum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs.

max(0,max v[i]) i

Note: on evite le probleme du vecteur de dimension 0 dont le max vaut moins l'infini

Definition at line 164 of file reductions.c.

166 {
167  Value max = VALUE_ZERO;
168 
169  for(; v!= NULL; v= v->succ)
170  max = value_max(val_of(v),max);
171 
172  return max;
173 }
#define VALUE_ZERO

References max, val_of, value_max, and VALUE_ZERO.

◆ vect_min()

Value vect_min ( Pvecteur  v)

Value vect_min(Pvecteur v): recherche du coefficient non nul minimum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini.

min v[i] i v[i]!=0

Note: changement de semantique puisque 0 etait renvoye auparavant pour le vecteur 0

just to avoid a gcc warning

Definition at line 208 of file reductions.c.

210 {
211  if(v!=NULL) {
212  Value min = val_of(v);
213  for (v=v->succ; v!= NULL; v= v->succ)
214  min = value_min(val_of(v),min);
215 
216  return min;
217  }
218  else {
219  vect_error("vect_min","ill. null vector as argument\n");
220  return VALUE_NAN; /* just to avoid a gcc warning */
221  }
222 }
#define value_min(v1, v2)
#define min(a, b)

References min, val_of, value_min, VALUE_NAN, and vect_error().

+ Here is the call graph for this function:

◆ vect_min0()

Value vect_min0 ( Pvecteur  v)

Value vect_min0(Pvecteur v): recherche du coefficient minimum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs.

min(0,min v[i]) i

Note: on evite le probleme du vecteur de dimension 0 dont le min vaut moins l'infini

Definition at line 186 of file reductions.c.

188 {
189  Value min = VALUE_ZERO;
190 
191  for(; v!= NULL; v= v->succ)
192  min = value_min(val_of(v),min);
193 
194  return min;
195 }

References min, val_of, value_min, and VALUE_ZERO.

◆ vect_oppos()

bool vect_oppos ( Pvecteur  v1,
Pvecteur  v2 
)

bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs

   ->   ->    ->

return v1 + v2 == 0 ;

Parameters
v11
v22

Definition at line 360 of file reductions.c.

362 {
363  /*
364  * Note: le test n'est pas optimal puisque v2 est parcouru et compare
365  * a v1 meme si ces coefficients ont ete deja ete compare lors du
366  * parcours de v1; mais cela evite le "marquage" des coefficients vus;
367  */
368  bool result;
369  Pvecteur pv;
370 
371  if(v1==NULL && v2==NULL)
372  result = true;
373  else if(v1==NULL || v2 == NULL)
374  result = false;
375  else {
376  result = true;
377 
378  for (pv = v1; pv != NULL && result == true; pv = pv->succ)
379  result = value_eq(val_of(pv),
380  value_uminus(vect_coeff(var_of(pv), v2)));
381 
382  for (pv = v2; pv != NULL && result == true; pv = pv->succ)
383  result = value_eq(val_of(pv),
384  value_uminus(vect_coeff(var_of(pv), v1)));
385 
386  }
387 
388  return result;
389 }

References Svecteur::succ, val_of, value_eq, value_uminus, var_of, and vect_coeff().

Referenced by contrainte_oppos(), egalite_equal(), egalite_in_liste(), and free_guards().

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

◆ vect_opposite_except()

bool vect_opposite_except ( Pvecteur  v1,
Pvecteur  v2,
Variable  var 
)

bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 .

e> == - <v2 . e>; e!=var

Parameters
v11
v22
varar

Definition at line 399 of file reductions.c.

402 {
403  Pvecteur pv;
404  /*
405  * Note: le test n'est pas optimal puisque v2 est parcouru et compare
406  * a v1 meme si ces coefficients ont ete deja ete compare lors du
407  * parcours de v1; mais cela evite le "marquage" des coefficients vus;
408  */
409  bool result;
410 
411  if(v1==NULL && v2==NULL)
412  result = true;
413  else if(v1==NULL)
414  result = v2->succ==NULL && var_of(v2)==var;
415  else if(v2 == NULL)
416  result = v1->succ==NULL && var_of(v1)==var;
417  else {
418  result = true;
419 
420  for (pv = v1; pv != NULL && result == true; pv = pv->succ)
421  if (var_of(pv) != var)
422  result = value_eq(val_of(pv),
423  value_uminus(vect_coeff(var_of(pv), v2)));
424 
425  for (pv = v2; pv != NULL && result == true; pv = pv->succ)
426  if (var_of(pv) != var)
427  result = value_eq(val_of(pv),
428  value_uminus(vect_coeff(var_of(pv), v1)));
429 
430  }
431 
432  return result;
433 }

References Svecteur::succ, val_of, value_eq, value_uminus, var_of, and vect_coeff().

Referenced by find_motif(), and inequalities_opposite_p().

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

◆ vect_pgcd_all()

Value vect_pgcd_all ( Pvecteur  v)

Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v.

return PGCD v[i] i v[i]!=0

Renvoie 1 pour le vecteur nul (ca devrait etre +infinity)

Definition at line 108 of file reductions.c.

110 {
111  Value d = (v!=NULL ? value_abs(val_of(v)) : VALUE_ONE);
112 
113  if (v!=NULL) {
114  for (v=v->succ; v!=NULL && value_notone_p(d); v=v->succ)
115  d = pgcd(d, value_abs(val_of(v)));
116  }
117  return d;
118 }
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
#define value_notone_p(val)
#define VALUE_ONE
#define value_abs(val)

References pgcd, val_of, value_abs, value_notone_p, and VALUE_ONE.

Referenced by analyze_expression(), calculate_delay(), gomory_trait_eq(), make_array_bounds(), make_rational_exp(), sc_find_equalities(), sommet_normalize(), and vect_normalize().

+ Here is the caller graph for this function:

◆ vect_pgcd_except()

Value vect_pgcd_except ( Pvecteur  v,
Variable  var 
)

Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'un vecteur v, sauf le coefficient correspondant a la variable var.

return PGCD v[i] i!=var v[i]!=0

Renvoie 1 pour le vecteur nul (ca devrait etre +infinity)

skip var's coeff if it comes first

Parameters
varar

Definition at line 130 of file reductions.c.

133 {
134  Value d;
135 
136  /* skip var's coeff if it comes first */
137  if ((v!= NULL) && (var_of(v) == var))
138  v = v->succ;
139 
140 
141  if(v==NULL)
142  d = VALUE_ONE;
143  else {
144  d = value_abs(val_of(v));
145  for (v=v->succ; v!=NULL && value_notone_p(d); v=v->succ)
146  if (var_of(v) != var)
147  d = pgcd(d,value_abs(val_of(v)));
148  }
149 
150  return d;
151 }

References pgcd, Svecteur::succ, val_of, value_abs, value_notone_p, VALUE_ONE, and var_of.

Referenced by contrainte_normalize(), and my_contrainte_normalize().

+ Here is the caller graph for this function:

◆ vect_prod_scal()

Value vect_prod_scal ( Pvecteur  v1,
Pvecteur  v2 
)

Value vect_prod_scal(v1,v2): produit scalaire de v1 et de v2.

sum v1[i] * v2[i] i

Parameters
v11
v22

Definition at line 82 of file reductions.c.

84 {
85  Value result = VALUE_ZERO;
86 
87  if(v2==NULL) return result;
88 
89  for(; v1!=NULL; v1 = v1->succ)
90  {
91  Value tmp = vect_coeff(var_of(v1),v2);
92  value_product(tmp, val_of(v1));
93  value_addto(result, tmp);
94  }
95 
96  return result;
97 }
#define value_addto(ref, val)
#define value_product(v, w)

References val_of, value_addto, value_product, VALUE_ZERO, var_of, and vect_coeff().

+ Here is the call graph for this function:

◆ vect_proport()

int vect_proport ( Pvecteur  v1,
Pvecteur  v2 
)

int vect_proport(Pvecteur v1, Pvecteur v2): test de la colinearite de deux vecteurs et de leur direction.

return 1 si les deux vecteurs sont colineaires et dans la meme direction c2 v1 == c1 v1, c1*c2 > 0 c'est le cas si v1 ou v2 vaut le vecteur nul -1 si les deux vecteurs sont colineaires et dans des directions opposees c2 v1 == c1 v1, c1*c2 < 0 0 s'ils ne sont pas colineaires

          ->    ->    ->

Note: aborte pour v1 == v2 == 0 parce qu'il est impossible de decider entre le retour de 1 et de -1

Modifications:

  • introduction des variables temporaires t1 et t2 pour ne pas effectuer le test de proprotionalite uniquement sur la fin des vecteurs v1 et v2; Francois Irigoin, 26 mars 1991
Parameters
v11
v22

Definition at line 455 of file reductions.c.

456 {
457  int prop = 1;
458 
459  if (v1==NULL && v2==NULL)
460  vect_error("vect_proport","ill. NULL v1 and v2 args\n");
461 
462  if (v1!=NULL && v2!=NULL) {
463  Value c1, c2;
464  Pvecteur t1;
465  Pvecteur t2;
466 
467  c1 = val_of(v1);
468  c2 = vect_coeff(var_of(v1),v2);
469  prop = 1;
470 
471  for (t1 = v1->succ; (t1!=NULL) && (prop); t1=t1->succ)
472  {
473  Value tmp1 = vect_coeff(var_of(t1),v2), tmp2;
474 
475  value_product(tmp1,c1);
476  tmp2 = value_mult(c2,val_of(t1));
477  prop = value_eq(tmp1,tmp2);
478  }
479 
480  for (t2 = v2; (t2!=NULL) && (prop != 0);t2=t2->succ)
481  {
482  Value tmp1 = vect_coeff(var_of(t2),v1), tmp2;
483 
484  value_product(tmp1,c2);
485  tmp2 = value_mult(c1,val_of(t2));
486  prop = value_eq(tmp1,tmp2);
487  }
488 
489  if(prop!=0) {
490  if (value_pos_p(value_mult(c1,c2)))
491  prop = 1;
492  else
493  prop = -1;
494  }
495  }
496 
497  return prop;
498 }
#define value_pos_p(val)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...

References Svecteur::succ, val_of, value_eq, value_mult, value_pos_p, value_product, var_of, vect_coeff(), and vect_error().

+ Here is the call graph for this function:

◆ vect_size()

int vect_size ( Pvecteur  v)

package vecteur - reductions

reductions.c

INTLIBRARY int vect_size(Pvecteur v): calcul du nombre de composantes non nulles d'un vecteur

sum abs(sgn(v[i])) i

Definition at line 47 of file reductions.c.

49 {
50  int nb_elem = 0;
51 
52  for (; v != NULL; v=v->succ)
53  nb_elem++;
54 
55  return (nb_elem);
56 }

Referenced by actual_convex_union(), add_elem_to_list_of_Pvecteur(), affine_expression_of_loop_index_p(), algorithm_row_echelon_generic(), alignment_p(), args_to_transformer(), bound_generation(), build_sc_with_several_uniform_ref(), check_tiling_legality(), choose_pattern(), chose_variable_to_project_for_feasability(), constant_constraint_check(), constraint_distribution(), constraints_sort_info(), constraints_sort_with_compare(), constraints_with_sym_cst_to_matrices(), contrainte_normalize(), contrainte_parallele(), contrainte_simple_equality(), dependence_cone_positive(), do_group_statement_constant(), eligible_for_coefficient_reduction_with_bounding_box_p(), EvalNormalized(), expression_and_precondition_to_integer_interval(), expression_integer_constant_p(), find_motif(), find_pattern(), gcd_and_constant_dependence_test(), hpfc_integer_constant_expression_p(), HpfcExpressionToInt(), look_for_the_best_counter(), loop_nest_to_tile(), loop_nest_to_wp65_code(), main(), make_constraint_expression(), make_loop_indice_equation(), make_reindex(), matrices_to_loop_sc(), movement_computation(), my_constraints_with_sym_cst_to_matrices(), normalized_constant_p(), parallel_tiling(), pip_solve(), pip_solve_min_with_big(), polynome_roots(), print_call_precondition(), region_range_nul_p(), sc_append(), sc_bounded_normalization(), sc_build_triang_elim_redund(), sc_creer_base(), sc_cute_convex_hull(), sc_dup1(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_empty_p(), sc_gen_read(), sc_image_computation(), sc_kill_db_eg(), sc_normalize2(), sc_projection_concat_proj_on_variables(), sc_restricted_to_variables_transitive_closure(), sc_safe_append(), sc_safe_elim_db_constraints(), sc_safe_kill_db_eg(), sc_to_tableau(), sc_triang_elim_redund(), set_dimensions_of_local_variables(), shift_expression_of_loop_index_p(), simple_indices_p(), simplify_constraint_with_bounding_box(), simplify_float_constraint(), single_var_vecteur_p(), sl_fprint_tab(), small_slope_and_first_quadrant_p(), sort_unknowns(), the_index_of_vect(), transformer_add_value_update(), transformer_add_variable_incrementation(), transformer_add_variable_update(), transformer_derivative_fix_point(), transformer_filter(), transformer_list_generic_transitive_closure(), transformer_normalize(), transformer_projection_with_redundancy_elimination_and_check(), try_reorder_expression_call(), uniform_dependence_p(), vect_const_p(), vect_lexicographic_unsafe_compare_generic(), vect_simple_definition_p(), vect_sort_in_place(), and xml_LoopOffset().

◆ vect_sum()

Value vect_sum ( Pvecteur  v)

Value vect_sum(Pvecteur v): somme des coefficients d'un vecteur (i.e.

produit scalaire avec le vecteur 1)

sum v[i] i

Definition at line 261 of file reductions.c.

262 {
263  Value sum = VALUE_ZERO;
264 
265  for (; v!=NULL; v=v->succ)
266  value_addto(sum, val_of(v));
267 
268  return sum;
269 }
t_real sum(int n1, int n2, int n3, t_real u[n1][n2][n3])
Definition: stencil.c:57

References Svecteur::succ, sum(), val_of, value_addto, and VALUE_ZERO.

Referenced by do_computation_intensity(), polynome_max_degree(), and polynomial_to_numerical().

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