PIPS
unaires.c
Go to the documentation of this file.
1 /*
2 
3  $Id: unaires.c 1671 2019-06-26 19:14:11Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 /* package vecteur - operations unaires */
26 
27 /*LINTLIBRARY*/
28 
29 #ifdef HAVE_CONFIG_H
30  #include "config.h"
31 #endif
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include "linear_assert.h"
36 
37 #include "boolean.h"
38 #include "arithmetique.h"
39 #include "vecteur.h"
40 
41 #define MALLOC(s,t,f) malloc(s)
42 #define FREE(p,t,f) free(p)
43 
44 /* void vect_normalize(Pvecteur v): division de tous les coefficients de v
45  * par leur pgcd; "normalisation" de vecteur directeur a coefficient entier
46  *
47  * -> -> -> ->
48  * si v == 0 alors v := 0;
49  * sinon
50  * pgcd = PGCD v[i];
51  * i
52  * -> ->
53  * v := v / pgcd
54  *
55  * Le pgcd est toujours positif.
56  *
57  * Ancien nom: vect_norm()
58  */
60 {
61  Value gcd = vect_pgcd_all(v);
62  if (value_notzero_p(gcd) && value_notone_p(gcd))
63  (void) vect_div(v, gcd);
64 }
65 
66 /* void vect_add_elem(Pvecteur * pvect, Variable var, Value val):
67  * addition d'un vecteur colineaire au vecteur de base var au vecteur vect
68  *
69  * -----> -----> --->
70  * *pvect := *pvect + val evar
71  */
72 void vect_add_elem(Pvecteur * pvect,Variable var, Value val)
73 {
74  if (val!=0)
75  {
76  Pvecteur vect;
77  for (vect=(*pvect); vect!=NULL; vect=vect->succ)
78  {
79  if (var_of(vect)==var)
80  {
81  value_addto(val_of(vect), val);
82  if (value_zero_p(val_of(vect)))
83  vect_erase_var(pvect, var_of(vect));
84  return;
85  }
86  }
87  // else: le coefficient valait 0 et n'etait pas represente
88  *pvect = vect_chain(*pvect, var, val);
89  }
90  // sinon, le vecteur est inchange et on ne fait rien
91 }
92 
93 /* void vect_erase_var(Pvecteur * ppv, Variable v): projection du
94  * vecteur *ppv selon la direction v (i.e. mise a zero de la
95  * coordonnee v du vecteur pointe par ppv)
96  *
97  * Soit ev le vecteur de base correspondant a v:
98  *
99  * ---> ---> ---> -> ->
100  * *ppv := *ppv - <*ppv . ev> ev
101  *
102  * Note: cette routine ne fait pas l'hypothese que chaque coordonnee
103  * n'apparait qu'une fois; on pourrait l'accelerer en forcant
104  * pvcour a NULL des que la coordonnee est trouvee.
105  */
106 void vect_erase_var(ppv, v)
107 Pvecteur *ppv;
108 Variable v;
109 {
110  Pvecteur pvprec, pvcour;
111 
112  for (pvprec = NULL, pvcour = (*ppv); pvcour != NULL;) {
113  /* A-t-on trouve la composante v? */
114  if (pvcour->var == v) {
115  /* Si oui, est-il possible de la dechainer? */
116  if (pvprec != NULL) {
117  /* elle n'est pas en tete de liste */
118  Pvecteur pvprim = pvcour;
119  pvcour = pvprec->succ = pvcour->succ;
120  FREE((char *)pvprim, VECTEUR, "vect_erase_var");
121  }
122  else {
123  /* Elle est en tete de liste; il faut modifier ppv */
124  *ppv = pvcour->succ;
125  FREE((char *)pvcour,VECTEUR,"vect_erase_var");
126  pvcour = *ppv;
127  }
128  }
129  else {
130  /* Non, on passe a la composante suivante... */
131  pvprec = pvcour;
132  pvcour = pvcour->succ;
133  }
134  }
135 }
136 
137 /* void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise
138  * de la coordonnee var du vecteur *ppv a la valeur val
139  *
140  * ---> ---> ---> ---> ---> --->
141  * *ppv = *ppv - <*ppv . evar> evar + val evar
142  */
143 void vect_chg_coeff(ppv,var,val)
144 Pvecteur *ppv;
145 Variable var;
146 Value val;
147 {
148  Pvecteur pvcour;
149 
150  if (val == 0) {
151  vect_erase_var(ppv, var);
152  }
153  else {
154  for (pvcour = (*ppv); pvcour != NULL; pvcour = pvcour->succ) {
155  if (pvcour->var == var) {
156  pvcour->val = val;
157  return;
158  }
159  }
160  /* on n'a pas trouve de composante var */
161  *ppv = vect_chain(*ppv,var,val);
162  }
163 }
164 
165 /* void vect_chg_var(Pvecteur *ppv, Variable v_old, Variable v_new)
166  * replace the variable v_old by v_new
167  */
168 void vect_chg_var(ppv,v_old,v_new)
169 Pvecteur *ppv;
170 Variable v_old,v_new;
171 {
172  Pvecteur pvcour;
173 
174  for (pvcour = (*ppv); pvcour != NULL; pvcour = pvcour->succ) {
175  if (pvcour->var == v_old){
176  pvcour->var = v_new;
177  return;
178  }
179  }
180 }
181 
183 {
184  for (; v; v=v->succ)
185  if (v->var && (value_one_p(v->val) || value_mone_p(v->val)))
186  return v->var;
187  return NULL;
188 }
189 
190 /* Pvecteur vect_del_var(Pvecteur v_in, Variable var): allocation d'un
191  * nouveau vecteur egal a la projection de v_in selon la direction var
192  * (i.e. le coefficient de la coordonnee var est mis a 0)
193  *
194  * Soit evar le vecteur de base correspondant a var:
195  *
196  * ---->
197  * allocate v_out;
198  *
199  * ----> ---> ----> ---> --->
200  * v_out := v_in - <v_out . evar> evar
201  *
202  * ---->
203  * return v_out;
204  *
205  */
207 Pvecteur v_in;
208 Variable var;
209 {
210  if(v_in!=NULL){
211  Pvecteur v_out = vect_dup(v_in);
212  vect_erase_var(&v_out,var);
213  return(v_out);
214  }
215  else
216  return(NULL);
217 }
218 
219 /* Variable vect_coeff(Variable var, Pvecteur vect): coefficient
220  * de coordonnee var du vecteur vect
221  * --->
222  * Soit evar le vecteur de base de nom var:
223  *
224  * ---> --->
225  * return <vect . evar>; (i.e. return vect[var])
226  *
227  */
228 Value vect_coeff(var,vect)
229 Variable var;
230 Pvecteur vect;
231 {
232  for ( ; vect != NULL ; vect = vect->succ)
233  if (var_of(vect) == var) {
234  assert(val_of(vect)!=VALUE_ZERO);
235  return(val_of(vect));
236  }
237  return VALUE_ZERO;
238 }
239 
240 /* Value vect_coeff_sum(Pvecteur vect): coefficient sum
241  * de tout les val de ce vecteur (devrait etre dans reduction? FC)
242  *
243  * return Value
244  * Lei Zhou Mar.25, 91
245  */
247 Pvecteur vect;
248 {
249  Value val = VALUE_ZERO;
250 
251  if ( vect->var == TCST )
252  return val;
253  for (; vect != NULL ; vect = vect->succ) {
254  value_addto(val,vecteur_val(vect));
255  assert(value_notzero_p(val_of(vect)));
256  }
257  return val;
258 }
259 
260 
261 /* Pvecteur vect_sign(Pvecteur v): application de l'operation signe au
262  * vecteur v
263  *
264  * -> ->
265  * v := signe(v );
266  * ->
267  * return v ;
268  */
270 Pvecteur v;
271 {
272  Pvecteur coord;
273 
274  for(coord = v; coord!=NULL; coord=coord->succ)
275  val_of(coord) = int_to_value(value_sign(val_of(coord)));
276 
277  return v;
278 }
279 
280 
281 /* void vect_sort_in_place(pv, compare)
282  * Pvecteur *pv;
283  * int (*compare)(Pvecteur *, Pvecteur *);
284  *
285  * Sorts the vector in place. It is an interface to qsort (stdlib).
286  * see man qsort about the compare function, which tells < == or >.
287  *
288  * FC 29/12/94
289  */
290 void vect_sort_in_place(pv, compare)
291 Pvecteur *pv;
292 int (*compare)(Pvecteur *, Pvecteur *);
293 {
294  int
295  n = vect_size(*pv);
296  Pvecteur
297  v,
298  *table,
299  *point;
300 
301  if ( n==0 || n==1 ) return;
302 
303  /* the temporary table is created and initialized
304  */
305  table = (Pvecteur*) malloc(sizeof(Pvecteur)*n);
306 
307  for (v=*pv, point=table; v!=(Pvecteur)NULL; v=v->succ, point++)
308  *point=v;
309 
310  /* sort!
311  */
312  /* FI: I do not know how to cast compare() properly */
313  /* qsort(table, n, sizeof(Pvecteur), int (* compare)()); */
314  qsort(table, n, sizeof(Pvecteur),(int (*)()) compare);
315 
316  /* the vector is regenerated in order
317  */
318  for (point=table; n>1; point++, n--)
319  (*point)->succ=*(point+1);
320 
321  (*point)->succ=(Pvecteur) NULL;
322 
323  /* clean and return
324  */
325  *pv=*table; free(table);
326 }
327 
328 /* Pvecteur vect_sort(v, compare)
329  * Pvecteur v;
330  * int (*compare)();
331  *
332  * ---> -->
333  * OUT = sorted IN
334  */
335 Pvecteur vect_sort(v, compare)
336 Pvecteur v;
337 int (*compare)(Pvecteur *, Pvecteur *);
338 {
339  Pvecteur
340  new = vect_dup(v);
341 
342  vect_sort_in_place(&new, compare);
343  return(new);
344 }
345 
346 /* for qsort, returns:
347  *
348  * - if v1 < v2
349  * 0 if v1 = v2
350  * + if v1 > v2
351  */
352 int vect_compare(pv1, pv2)
353 Pvecteur *pv1, *pv2;
354 {
355  return(strcmp((char *)&var_of(*pv1), (char *)&var_of(*pv2)));
356 }
357 
358 /* void Pvecteur_separate_on_sign(v, pvpos, pvneg)
359  * Pvecteur v, *pvpos, *pvneg;
360  *
361  * IN: v
362  * OUT: pvpos, pvneg
363  *
364  * this function builds 2 vectors composed of the positive and negative
365  * parts of the initial vector v which is not modified.
366  *
367  * (c) FC 16/05/94
368  */
369 void Pvecteur_separate_on_sign(v, pvpos, pvneg)
370 Pvecteur v, *pvpos, *pvneg;
371 {
372  Pvecteur vc;
373  Value val;
374  Variable var;
375 
376  *pvneg = VECTEUR_NUL,
377  *pvpos = VECTEUR_NUL;
378 
379  for(vc=v; vc; vc=vc->succ)
380  {
381  var = var_of(vc),
382  val = val_of(vc);
383  if (value_neg_p(val))
384  vect_add_elem(pvneg, var, value_uminus(val));
385  else
386  vect_add_elem(pvpos, var, val);
387  }
388 }
389 
390 
391 /* bool vect_common_variables_p(Pvecteur v1, v2) BA 19/05/94
392  * input : two vectors.
393  * output : true if they have at least one common variable,
394  * false otherwise.
395  * modifies : nothing.
396  */
398 Pvecteur v1, v2;
399 {
400  Pvecteur ev;
401 
402  for(ev = v1; !VECTEUR_NUL_P(ev); ev = ev->succ) {
404  return true;
405  }
406  return false;
407 }
408 
409 
410 /* bool vect_contains_variable_p(Pvecteur v, Variable var) BA 19/05/94
411  * input : a vector and a variable
412  * output : true if var appears as a component of v, false otherwise.
413  * modifies : nothing
414  */
416 Pvecteur v;
417 Variable var;
418 {
419  bool in_base;
420 
421  for(; !VECTEUR_NUL_P(v) && !variable_equal(vecteur_var(v), var); v = v->succ)
422  ;
423  in_base = !VECTEUR_NUL_P(v);
424  return(in_base);
425 }
426 
427 /* qsort() is not safe if the comparison function is not antisymmetric.
428  * It wanders out of the array to be sorted. It's a pain to debug.
429  * Let's play safe.
430  */
431 /* Version for equations */
432 int
434  int (*compare)(Pvecteur*, Pvecteur*))
435 {
436  int cmp12 = 0;
437  int cmp21 = 0;
438 
439  cmp12 = vect_lexicographic_unsafe_compare(v1, v2, compare);
440  cmp21 = vect_lexicographic_unsafe_compare(v2, v1, compare);
441 
442  assert(cmp12 == -cmp21);
443 
444  return cmp12;
445 }
446 
447 /* Version for inequalities */
448 int
450  int (*compare)(Pvecteur*, Pvecteur*))
451 {
452  int cmp12 = 0;
453  int cmp21 = 0;
454 
455  cmp12 = vect_lexicographic_unsafe_compare2(v1, v2, compare);
456  cmp21 = vect_lexicographic_unsafe_compare2(v2, v1, compare);
457 
458  assert(cmp12 == -cmp21);
459 
460  return cmp12;
461 }
462 
463 int
465  int (*compare)(Pvecteur*, Pvecteur*))
466 {
467  int cmp = 0;
468 
469  cmp = vect_lexicographic_unsafe_compare_generic(v1, v2, compare, true);
470 
471  return cmp;
472 }
473 
475  int (*compare)(Pvecteur*, Pvecteur*))
476 {
477  int cmp = 0;
478 
479  cmp = vect_lexicographic_unsafe_compare_generic(v1, v2, compare, false);
480 
481  return cmp;
482 }
483 
484 /* The two sparse vectors are assumed to have exactly the same
485  structure, the same non-zero components in the same order. */
487 {
488  Pvecteur pv1, pv2;
489  int cmp = 0;
490 
491  for(pv1 = v1, pv2 = v2;
492  !VECTEUR_UNDEFINED_P(pv1) && !VECTEUR_UNDEFINED_P(pv2) && cmp == 0;
493  pv1 = pv1->succ, pv2= pv2->succ) {
494  Value c1 = vecteur_val(pv1);
495  Value c2 = vecteur_val(pv2);
496  if(value_gt(c1, c2))
497  cmp = 1;
498  else if(value_gt(c2, c1))
499  cmp = -1;
500  }
501  return cmp;
502 }
503 
504 /* This function is a trade-off between a real lexicographic sort
505  * and a prettyprinting function also used for code generation.
506  *
507  * Its goal is to sort constraints used as loop bounds or obtained as
508  * preconditions. Each constraint or vector is assumed internally
509  * sorted using the compare function, e.g. 2i + 3j + 4 is correct,
510  * while 3j + 4 + 2i is not if the alphabetical order is used and if
511  * constants appear as last vector elements.
512  *
513  * When multiple constraints appear in a constraint system, we usually
514  * want simpler constraints and vectors first but some order between
515  * variables is still used. E.g. {1, i, i+1, i+j+1, j}. Here, we do
516  * not take into account the vector length as a primary critarion, but
517  * the alphabetical order. The above system is first reduced to a set
518  * of "words" {"", "i", "ij", "j"} and is lexicographically sorted
519  * [This is simplified: each letter in this example is in fact a work
520  * in the general case]. In case, two "words" are identical, e.g. "ij"
521  * and "ij", the length of the two underlying vectors, e.g. i+j,
522  * i+j+1, i+2*j, are compared. If they are equal, the lexicographic
523  * order of the coefficients is used to disambiguate the comparison,
524  * e.g. i+j < i+2j.
525  *
526  * A lot of problems arise because 0 is not represented. It's
527  * hard to compare I==0 and I==1 because they do not have the
528  * same numbers of sparse components.
529  *
530  * Furthermore, vectors representing equalities and inequalities must not
531  * be handled in the same way because only equalities can be multiplied by -1.
532  *
533  * Not satisfying for Transformations/Tiling.sub/tiling05: 0 constant
534  * terms should be handled in a special way so as to have "i" be less
535  * than "i-1". Since -1 is less than 0, the longest constraint comes
536  * first.
537  *
538  * Not satisfying for Transformations/Tiling.sub/tiling04: scopes had
539  * an impact on the comparisons that is not natural for users.
540  */
541 int
543  int (*compare)(Pvecteur*, Pvecteur*),
544  bool is_equation __attribute__ ((unused)))
545 {
546  /* It is assumed that vectors v1 and v2 are already
547  lexicographically sorted, according to the same lexicographic
548  order.
549 
550  The constant term should always be the last one. But the
551  lexicographic sort now move them ahead! So we have to skip them
552  at each position but we assume that they are both either
553  leading or trailing elements. */
554  int cmp = 0;
555  Pvecteur pv1 = term_cst(v1)? v1->succ : v1;
556  Pvecteur pv2 = term_cst(v2)? v2->succ : v2;
557 
558  /* Lexicographic comparison on variable names */
559  for(;
560  !VECTEUR_UNDEFINED_P(pv1) && !VECTEUR_UNDEFINED_P(pv2) && cmp == 0
561  && !term_cst(pv1) && !term_cst(pv2);
562  pv1 = pv1->succ, pv2= pv2->succ) {
563 
564  cmp = compare(&pv1, &pv2);
565  }
566 
567  if(cmp==0) {
568  if(VECTEUR_UNDEFINED_P(pv1)) {
569  if(VECTEUR_UNDEFINED_P(pv2)) {
570  /* Use vector lengths as discriminator in case an initial
571  constant term makes a difference. */
572  int n1 = vect_size(v1);
573  int n2 = vect_size(v2);
574  if(n1>n2)
575  cmp = 1;
576  else if(n1<n2)
577  cmp = -1;
578  else {
579  /* Use lexicographic order on coefficients as discriminator */
581  }
582  }
583  else
584  cmp = -1; // v2 is longer
585  }
586  else {
587  if(VECTEUR_UNDEFINED_P(pv2))
588  cmp = 1; // v1 is longer
589  else {
590  if(term_cst(pv1)) {
591  if(term_cst(pv2)) {
592  // Use only constant terms as differentiator
593  // cmp = value_comparison(vecteur_val(pv1), vecteur_val(pv2));
594  // To get lower bounds before upper bounds when only one variables is constrained
596  }
597  else
598  cmp = -1;
599  }
600  else {
601  if(term_cst(pv2))
602  cmp = 1;
603  else
604  /* This point should not be reachable unless the two vectors
605  are identical and end with two constant terms */
606  cmp = 0;
607  }
608  }
609  }
610  }
611 
612  /* We need a total order to avoid non-determinism, i.e. dependence
613  on pointer values */
614  assert(cmp!=0 || vect_equal(v1, v2));
615 
616  return cmp;
617 }
618 
619 
620 /*
621  * that is all
622  */
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
#define VALUE_ZERO
#define value_mone_p(val)
#define value_sign(v)
trian operators on values
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define value_gt(v1, v2)
#define value_notzero_p(val)
#define value_uminus(val)
unary operators on values
void const char const char const int
#define value_notone_p(val)
#define value_one_p(val)
#define value_zero_p(val)
int Value
#define value_addto(ref, val)
#define value_neg_p(val)
void * malloc(YYSIZE_T)
void free(void *)
Value vect_pgcd_all(Pvecteur v)
Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v.
Definition: reductions.c:108
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
bool variable_equal(Variable v1, Variable v2)
package vecteur - routines sur les variables
Definition: variable.c:62
#define assert(ex)
Definition: newgen_assert.h:41
Pvecteur vect_chain(Pvecteur v_in, Variable var, Value coeff)
package vecteur routines internes au package
Definition: private.c:69
Pvecteur vect_div(Pvecteur v, Value x)
Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different d...
Definition: scalaires.c:52
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Value val
Definition: vecteur-local.h:91
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_val(v)
#define vecteur_var(v)
#define val_of(varval)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
struct Svecteur * Pvecteur
#define VECTEUR_NUL_P(v)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define var_of(varval)
#define term_cst(varval)
#define VECTEUR
package sur les vecteurs creux et les bases
Definition: vecteur-local.h:51
#define VECTEUR_UNDEFINED_P(v)
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
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106
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
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
Pvecteur vect_del_var(Pvecteur v_in, Variable var)
Pvecteur vect_del_var(Pvecteur v_in, Variable var): allocation d'un nouveau vecteur egal a la project...
Definition: unaires.c:206
int vect_compare(Pvecteur *pv1, Pvecteur *pv2)
for qsort, returns:
Definition: unaires.c:352
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
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
#define FREE(p, t, f)
Definition: unaires.c:42
Variable vect_one_coeff_if_any(Pvecteur v)
Definition: unaires.c:182
int vect_lexicographic_unsafe_compare_generic(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *), bool is_equation __attribute__((unused)))
This function is a trade-off between a real lexicographic sort and a prettyprinting function also use...
Definition: unaires.c:542
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143
bool vect_contains_variable_p(Pvecteur v, Variable var)
bool vect_contains_variable_p(Pvecteur v, Variable var) BA 19/05/94 input : a vector and a variable o...
Definition: unaires.c:415
void Pvecteur_separate_on_sign(Pvecteur v, Pvecteur *pvpos, Pvecteur *pvneg)
void Pvecteur_separate_on_sign(v, pvpos, pvneg) Pvecteur v, *pvpos, *pvneg;
Definition: unaires.c:369
static int vect_lexicographic_coefficient_comparison(Pvecteur v1, Pvecteur v2)
The two sparse vectors are assumed to have exactly the same structure, the same non-zero components i...
Definition: unaires.c:486
Pvecteur vect_sign(Pvecteur v)
Pvecteur vect_sign(Pvecteur v): application de l'operation signe au vecteur v.
Definition: unaires.c:269
bool vect_common_variables_p(Pvecteur v1, Pvecteur v2)
bool vect_common_variables_p(Pvecteur v1, v2) BA 19/05/94 input : two vectors.
Definition: unaires.c:397
int vect_lexicographic_compare2(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
Version for inequalities.
Definition: unaires.c:449
Pvecteur vect_sort(Pvecteur v, int *compare)
Pvecteur vect_sort(v, compare) Pvecteur v; int (*compare)();.
Definition: unaires.c:335
void vect_chg_var(Pvecteur *ppv, Variable v_old, Variable v_new)
void vect_chg_var(Pvecteur *ppv, Variable v_old, Variable v_new) replace the variable v_old by v_new
Definition: unaires.c:168
Value vect_coeff_sum(Pvecteur vect)
Value vect_coeff_sum(Pvecteur vect): coefficient sum de tout les val de ce vecteur (devrait etre dans...
Definition: unaires.c:246
int vect_lexicographic_unsafe_compare2(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
Definition: unaires.c:474
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
int vect_lexicographic_unsafe_compare(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
Definition: unaires.c:464