PIPS
vvs.c
Go to the documentation of this file.
1 /*
2 
3  $Id: vvs.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS 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 General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 
28 /* Name : substitution.c
29  * Package : prgm_mapping
30  * Author : Platonoff Alexis
31  * Date : 4 october 1993
32  * Historic :
33  * Documents:
34  * Comments :
35  * This file contains the functions for manipulating substitutions.
36  */
37 
38 /* Ansi includes */
39 #include<stdio.h>
40 
41 /* Newgen includes */
42 #include "genC.h"
43 
44 /* C3 includes */
45 #include "boolean.h"
46 #include "arithmetique.h"
47 #include "vecteur.h"
48 #include "contrainte.h"
49 #include "ray_dte.h"
50 #include "sommet.h"
51 #include "sg.h"
52 #include "sc.h"
53 #include "polyedre.h"
54 #include "union.h"
55 #include "matrice.h"
56 #include "matrix.h"
57 
58 /* Pips includes */
59 #include "ri.h"
60 #include "constants.h"
61 #include "ri-util.h"
62 #include "misc.h"
63 #include "graph.h"
64 #include "paf_ri.h"
65 #include "text.h"
66 #include "text-util.h"
67 #include "paf-util.h"
68 #include "prgm_mapping.h"
69 
70 /* Macro functions */
71 #define VV_VAR(x) var_val_variable(x)
72 #define VV_COEFF(x) expression_to_int(var_val_value(x))
73 #define VV_VAL_(x) normalized_linear_(expression_normalized(var_val_value(x)))
74 #define VV_VAL(x) normalized_linear(expression_normalized(var_val_value(x)))
75 #define MAKE_VV(var, coeff, val) make_var_val(var, \
76  make_expression(make_syntax(is_syntax_call, \
77  make_call(make_integer_constant_entity(coeff), \
78  NIL)), \
79  make_normalized(is_normalized_linear, val)))
80 
81 /* Global variables */
82 
83 /* Internal variables */
84 
85 /* ======================================================================== */
87 Pvecteur pv;
88 {
89  Ppolynome pp;
90 
91  if(VECTEUR_NUL_P(pv))
92  pp = POLYNOME_NUL;
93  else {
94  Pvecteur vec;
95 
96  pp = NULL;
97  for(vec = pv; vec != NULL; vec = vec->succ) {
98  Variable var = vecteur_var(vec);
99  float val = (float) vecteur_val(vec);
100  Ppolynome newpp;
101 
102  newpp = make_polynome(val, var, 1);
103  polynome_succ(newpp) = pp;
104  pp = newpp;
105  }
106  }
107 
108  return(pp);
109 }
110 
111 
112 /* ======================================================================== */
113 list make_vvs(var, coeff, val)
114 entity var;
115 int coeff;
116 Pvecteur val;
117 {
118  return(CONS(VAR_VAL, MAKE_VV(var, coeff, val), NIL));
119 }
120 
121 
122 /* ======================================================================== */
124 var_val vv;
125 {
126  return(MAKE_VV(VV_VAR(vv), VV_COEFF(vv), vect_dup((Pvecteur) VV_VAL(vv))));
127 }
128 
129 
130 /* ======================================================================== */
132 list vvs;
133 {
134  list new_vvs = NIL, l;
135 
136  for(l = vvs; !ENDP(l); POP(l)) {
137  var_val v = VAR_VAL(CAR(l));
138 
139  new_vvs = gen_nconc(new_vvs, CONS(VAR_VAL, dup_vv(v), NIL));
140  }
141  return(new_vvs);
142 }
143 
144 
145 /* ======================================================================== */
146 void fprint_vvs(fp, vvs)
147 FILE *fp;
148 list vvs;
149 {
150  if(vvs == NULL)
151  fprintf(fp, "Var_vals Empty\n");
152  for( ; !ENDP(vvs); POP(vvs))
153  fprint_vv(fp, VAR_VAL(CAR(vvs)));
154 }
155 
156 
157 /* ======================================================================== */
158 void fprint_vv(fp, vv)
159 FILE *fp;
160 var_val vv;
161 {
163  fprintf(fp, "%s --> ", entity_local_name(VV_VAR(vv)));
164  else {
165  int coeff = VV_COEFF(vv);
166  if(coeff == 1)
167  fprintf(fp, "%s --> ", entity_local_name(VV_VAR(vv)));
168  else if(coeff == -1)
169  fprintf(fp, "-%s --> ", entity_local_name(VV_VAR(vv)));
170  else
171  fprintf(fp, "%d.%s --> ", coeff, entity_local_name(VV_VAR(vv)));
172  }
173 
174  pu_vect_fprint(fp, (Pvecteur) VV_VAL(vv));
175 }
176 
177 
178 /* ======================================================================== */
179 /*
180  * list vvs_on_vvs(list vv1, vv2)
181  *
182  * Applies "vv1" on "vv2", i.e. replaces in the rhs of "vv2" the variables
183  * appearing in the lhs of "vv1" by their value. It does not add the
184  * substitutions of "vv1" in the list.
185  *
186  * For each sub of "vv1", it walks through all the sub of "vv2": for a given
187  * sub of "vv1" (c1.e1 = pv1) and a given sub of "vv2" (c2.e2 = pv2),
188  * there are two cases:
189  *
190  * 1. the lhs are equal, so a new sub is computed from the following
191  * equality: (p/c1).pv1 = (p/c2).pv2 = 0, with p = lcm(c1,c2).
192  *
193  * 2. the lhs are not equal, so pv2 may be modified if e1 appears in it:
194  * pv2 = cc2.e1 + pv0
195  * => pv2 = (cc2/g)*pv1 + (c1/g)*pv0, with g = gcd(cc2, c1)
196  *
197  */
198 list vvs_on_vvs(vv1, vv2)
199 list vv1, vv2;
200 {
201  list l1, l2, new_vvs = gen_concatenate(vv2, NIL);
202 
203  for(l1 = vv1; !ENDP(l1); POP(l1)) {
204  var_val v1 = VAR_VAL(CAR(l1));
205  entity e1 = VV_VAR(v1);
206  int c1 = VV_COEFF(v1);
207  Pvecteur pv1 = (Pvecteur) VV_VAL(v1);
208 
209  for(l2 = new_vvs; !ENDP(l2); POP(l2)) {
210  var_val v2 = VAR_VAL(CAR(l2));
211  entity e2 = VV_VAR(v2);
212  int c2 = VV_COEFF(v2);
213  Pvecteur pv2 = (Pvecteur) VV_VAL(v2);
214 
215  if(same_entity_p(e1, e2)) {
216  list il, el, aux_vvs;
217  Psysteme aps1 = sc_new(), aps2;
218  Pvecteur pv;
219  int p;
220 
221  p = ppcm(c1, c2);
222  pv = vect_cl2_ofl_ctrl((p/c1), pv1, -(p/c2), pv2, NO_OFL_CTRL);
223 
224  il = vecteur_to_list(pv);
225  sc_add_egalite(aps1, contrainte_make(pv));
226 
227  aps2 = elim_var_with_eg(aps1, &il, &el);
228  aux_vvs = make_vvs_from_sc(aps2, el);
229 
230  if(ENDP(aux_vvs))
231  return(NIL);
232  if(!ENDP(CDR(aux_vvs)))
233  user_error("vvs_on_vvs", "There are more than one vv\n");
234 
235  CDR(aux_vvs) = CDR(l2);
236  CDR(l2) = aux_vvs;
237  }
238  else {
239  int cc2, g;
240  if( (cc2 = vect_coeff((Variable) e1, pv2)) != 0 ) {
241  g = pgcd(cc2, c1);
242  vect_erase_var(&pv2, (Variable) e1);
244  (vect_cl2_ofl_ctrl((c1/g), pv2, (cc2/g), pv1, NO_OFL_CTRL));
245  }
246  }
247  }
248  }
249  return(new_vvs);
250 }
251 
252 
253 /* ======================================================================== */
254 /*
255  * list compose_vvs(list vv1, vv2)
256  *
257  * Applies "vv1" on "vv2" AND "vv2" on "vv1", i.e. replaces in the rhs of
258  * "vv2" the variables appearing in the lhs of "vv1" by their value AND
259  * vice-versa.
260  *
261  * For each sub of "vv1", it walks through all the sub of "vv2": for a given
262  * sub of "vv1" (c1.e1 = pv1) and a given sub of "vv2" (c2.e2 = pv2),
263  * there are two cases:
264  *
265  * 1. the lhs are equal, so a new sub is computed from the following
266  * equality: (p/c1).pv1 = (p/c2).pv2 = 0, with p = lcm(c1,c2).
267  *
268  * 2. the lhs are not equal, so pv2 may be modified if e1 appears in it:
269  * pv2 = cc2.e1 + pv0
270  * => pv2 = (cc2/g)*pv1 + (c1/g)*pv0, with g = gcd(cc2, c1)
271  *
272  * Note: we work upon copies of "vv1" and "vv2".
273  */
274 list compose_vvs(vv1, vv2)
275 list vv1, vv2;
276 {
277  list l1, l2, p2, cvv1, cvv2;
278 
279  cvv1 = dup_vvs(vv1);
280  cvv2 = dup_vvs(vv2);
281 
282  if(cvv1 == NIL) {
283  if(cvv2 == NIL)
284  return(NIL);
285  else
286  return(cvv2);
287  }
288  if(cvv2 == NIL)
289  return(cvv1);
290 
291  for(l1 = cvv1; !ENDP(l1); POP(l1)) {
292  var_val v1 = VAR_VAL(CAR(l1));
293  entity e1 = VV_VAR(v1);
294  int c1 = VV_COEFF(v1);
295  Pvecteur pv1 = (Pvecteur) VV_VAL(v1);
296 
297  p2 = NIL;
298  for(l2 = cvv2; !ENDP(l2); POP(l2)) {
299  var_val v2 = VAR_VAL(CAR(l2));
300  entity e2 = VV_VAR(v2);
301  int c2 = VV_COEFF(v2);
302  Pvecteur pv2 = (Pvecteur) VV_VAL(v2);
303 
304  if(same_entity_p(e1, e2)) {
305  list il, el, aux_vvs;
306  Psysteme aps1 = sc_new(), aps2;
307  Pvecteur pv;
308  int p;
309 
310  p = ppcm(c1,c2);
311  pv = vect_cl2_ofl_ctrl((p/c1), pv1, -(p/c2), pv2, NO_OFL_CTRL);
312 
313  il = vecteur_to_list(pv);
314  sc_add_egalite(aps1, contrainte_make(pv));
315 
316  aps2 = elim_var_with_eg(aps1, &il, &el);
317  aux_vvs = sc_to_vvs(aps2, el);
318 
319  /* If "pv" is not NULL and "aux_vvs" is NULL, it means that
320  * elim_var_with_eg() did not work.
321  */
322  if(ENDP(aux_vvs)) {
323  /* "v1 == v2", so "v2" is remove from "cvv2" */
324  if(p2 == NIL)
325  cvv2 = CDR(l2);
326  else
327  CDR(p2) = CDR(l2);
328  }
329  else if(!ENDP(CDR(aux_vvs)))
330  user_error("compose_vvs", "There are more than one vv\n");
331  else {
332  VAR_VAL(CAR(l2)) = VAR_VAL(CAR(aux_vvs));
333  p2 = l2;
334  }
335  }
336  else {
337  int cc2;
338  if( (cc2 = vect_coeff((Variable) e1, pv2)) != 0 ) {
339  int g = pgcd(cc2, c1);
340  vect_erase_var(&pv2, (Variable) e1);
342  (vect_cl2_ofl_ctrl((c1/g), pv2, (cc2/g), pv1, NO_OFL_CTRL));
343  }
344  p2 = l2;
345  }
346  }
347  }
348  for(l1 = cvv2; !ENDP(l1); POP(l1)) {
349  var_val v1 = VAR_VAL(CAR(l1));
350  entity e1 = VV_VAR(v1);
351  int c1 = VV_COEFF(v1);
352  Pvecteur pv1 = (Pvecteur) VV_VAL(v1);
353  for(l2 = cvv1; !ENDP(l2); POP(l2)) {
354  var_val v2 = VAR_VAL(CAR(l2));
355  entity e2 = VV_VAR(v2);
356  Pvecteur pv2 = (Pvecteur) VV_VAL(v2);
357 
358  if(same_entity_p(e1, e2)) {
359  user_error("compose_vvs", "Entities should be different\n");
360  }
361  else {
362  int cc2;
363  if( (cc2 = vect_coeff((Variable) e1, pv2)) != 0 ) {
364  int g = pgcd(cc2, c1);
365  vect_erase_var(&pv2, (Variable) e1);
367  (vect_cl2_ofl_ctrl((c1/g), pv2, (cc2/g), pv1, NO_OFL_CTRL));
368  }
369  }
370  }
371  }
372  return(gen_nconc(cvv1, cvv2));
373 }
374 
375 
376 /* ======================================================================== */
377 /* list sc_to_vvs(sc, var_l): returns the substitution equivalent to
378  * the system given in argument knowing that the substituted variables are
379  * contained in "var_l", in the same order. Then, their must be as many var
380  * in "var_l" as there are equalities in "sc".
381  */
382 list sc_to_vvs(sc, var_l)
383 Psysteme sc;
384 list var_l;
385 {
386  list vvs = NIL;
387 
388  Pcontrainte pc;
389  Pvecteur pv_elim;
390 
391  for(pc = sc->egalites ; pc != NULL; pc = pc->succ, var_l = CDR(var_l))
392  {
393  bool var_not_found = true;
394  Pvecteur pv = pc->vecteur;
395  entity var = ENTITY(CAR(var_l));
396 
397  for( ; !VECTEUR_NUL_P(pv) && var_not_found; )
398  {
399  if( ((pv->val == 1) || (pv->val == -1)) && (pv->var != TCST) )
400  {
401  if(same_entity_p((entity) pv->var, var))
402  var_not_found = false;
403  else
404  pv = pv->succ;
405  }
406  else
407  pv = pv->succ;
408  }
409  if(! var_not_found)
410  {
411  /* We have: val.var + v = 0 => var = -val.v, with val in {1, -1}
412  * however: V = val.var + v => v = V - val.var
413  * so: var = -val(V - val.var) => var = -val.V + (val)^2.var => var = -val.V + var
414  */
415  pv_elim = vect_cl2_ofl_ctrl((pv->val)*(-1), pc->vecteur, 1,
416  vect_new(pv->var, 1),
417  NO_OFL_CTRL);
418 
419  vvs = compose_vvs(vvs, CONS(VAR_VAL, MAKE_VV(var, 1, pv_elim), NIL));
420  }
421  else
422  user_error("sc_to_vvs", "The var must in the equality\n");
423  }
424  return(vvs);
425 }
426 
427 
428 /* ======================================================================== */
430 list vvs;
431 {
432  Psysteme ps = sc_new();
433 
434  for( ; !ENDP(vvs) ; POP(vvs)) {
435  var_val vv = VAR_VAL(CAR(vvs));
436  entity v = VV_VAR(vv);
437  int c = VV_COEFF(vv);
438  Pvecteur pv = (Pvecteur) VV_VAL(vv);
439 
440  vect_add_elem(&pv, (Variable) v, -c);
442  }
443  sc_creer_base(ps);
444  return(ps);
445 }
446 
447 
448 /* ======================================================================== */
450 list vvs;
451 {
452  Psysteme ps;
453  ps = vvs_to_sc(vvs);
455 }
456 
457 typedef bool (*argh)(Pvecteur*, Pvecteur*);
458 
459 /* ======================================================================== */
460 /*
461  * Ppolynome vvs_on_polynome(list vvs, Ppolynome pp)
462  *
463  * applies a substitution "sub" on a polynome "pp".
464  */
466 list vvs;
467 Ppolynome pp;
468 {
469  list avvs, used_vars;
470 
471  if(vvs == NIL)
472  return(pp);
473 
474  /* Special treatment if there is only one sub */
475  if(CDR(vvs) == NIL) {
476  var_val vv = VAR_VAL(CAR(vvs));
477  Variable var = (Variable) var_val_variable(vv);
478  int c = VV_COEFF(vv);
479  Pvecteur pv = (Pvecteur) VV_VAL(vv);
480  Ppolynome ppv = vecteur_to_polynome(pv);
481 
482  if(c != 1)
483  user_error("vvs_on_polynome", "Coeff is not 1\n");
484  else
485  pp = prototype_var_subst(pp, var, ppv);
486 
487  return(pp);
488  }
489 
491 
492  for(avvs = vvs; !ENDP(avvs) && !ENDP(used_vars); POP(avvs)) {
493  var_val vv = VAR_VAL(CAR(avvs));
494  entity var = VV_VAR(vv);
495  int c = VV_COEFF(vv);
496  list prec, curr;
497  bool found = false;
498 
499  if(c != 1)
500  user_error("vvs_on_polynome", "Coeff is not 1\n");
501 
502  for(curr = used_vars, prec = NIL; !ENDP(curr) && (!found); POP(curr)) {
503  if(same_entity_p(var, ENTITY(CAR(curr)))) {
504  found = true;
505  if(prec == NIL)
506  used_vars = CDR(used_vars);
507  else
508  CDR(prec) = CDR(curr);
509  }
510  prec = curr;
511  }
512 
513  if(found) {
514  Pvecteur pv = (Pvecteur) VV_VAL(vv);
515  Ppolynome ppv = vecteur_to_polynome(pv);
516 
517  pp = prototype_var_subst(pp, (Variable) var, ppv);
518  }
519  }
520 
521  return(pp);
522 }
523 
524 
525 /* ======================================================================== */
526 /* Pvecteur vvs_on_vecteur(list vvs, Pvecteur pv): applies the
527  * substitution "s" on the vecteur "pv". The substitution is done directly
528  * on "pv" ; so, it is modified and is the returned value.
529  */
531 list vvs;
532 Pvecteur pv;
533 {
534  list avvs;
535 
536  if(ENDP(vvs))
537  return(pv);
538 
539  for(avvs = vvs; !ENDP(avvs) ; POP(avvs)) {
540  var_val vv = VAR_VAL(CAR(avvs));
541  entity vve = VV_VAR(vv);
542  int vvc = VV_COEFF(vv);
543  Pvecteur vvpv = (Pvecteur) VV_VAL(vv);
544  Value val = vect_coeff((Variable) vve, pv);
545 
546  if(vvc != 1)
547  user_error("vvs_on_vecteur", "Coeff is not 1\n");
548 
549  /* We substitute "vvpv" to "vve" in "pv". */
550  if(val != 0) {
551  /* We delete the occurence of "vve"... */
552  vect_erase_var(&pv, (Variable) vve);
553 
554  /* ... and we add "val*vvpv" to "pv". */
555  pv = vect_cl_ofl_ctrl(pv, val, vvpv, NO_OFL_CTRL);
556  }
557  }
558  return(pv);
559 }
560 
561 
562 /* ======================================================================== */
563 /* Psysteme vvs_on_systeme(list vvs, Psysteme ps): applies the
564  * substitution "s" on the system "ps". The substitution is done directly on
565  * "ps" ; so, it is modified and is the returned value.
566  */
568 list vvs;
569 Psysteme ps;
570 {
571  Psysteme new_ps = ps;
572  list avvs;
573 
574  if(ENDP(vvs))
575  return(ps);
576 
577  for(avvs = vvs; !ENDP(avvs) ; POP(avvs)) {
578  var_val vv = VAR_VAL(CAR(avvs));
579  entity e = VV_VAR(vv);
580  int c = VV_COEFF(vv);
581  Pvecteur pv = (Pvecteur) VV_VAL(vv);
582 
583  /* We substitute "pv" to "c.e" in ps. */
584  substitute_var_with_vec(new_ps, e, c, pv);
585  }
586 
587  return(new_ps);
588 }
589 
590 
591 /* ======================================================================== */
592 /*
593  * list make_vvs_from_sc(Psysteme ps_aux, list var_l): returns a list of
594  * substitutions (var_val) computed with "ps_aux" and "var_l".
595  *
596  * Only the equations of "ps_aux" are considered and there must be as many
597  * equations as there are variables in "var_l".
598  * Also, the list equations and of variables must be ordered so as to have the
599  * following conditions: one variable MUST appear in the corresponding
600  * equation (i.e., it has a non zero coefficient) and MUST NOT appear in all
601  * the others equations.
602  *
603  * Example: ps_aux = {l5 + l2 - l3 == 0, l3 + l4 - l1 == 0}
604  * var_l = {l2, l1}
605  *
606  * the function returns the substitution {l2 <-- l3 - l5, l1 <-- l3 + l4}
607  *
608  * Note: better than sc_to_vvs(), above.
609  */
610 list make_vvs_from_sc(ps_aux, var_l)
611 Psysteme ps_aux;
612 list var_l;
613 {
614  list new_vvs = NIL, l;
615  Pcontrainte pc = ps_aux->egalites;
616 
617  for(l = var_l; !ENDP(l); POP(l), pc = pc->succ) {
618  entity var = ENTITY(CAR(l));
619  Pvecteur vec = pc->vecteur, new_vec;
620  int val = vect_coeff((Variable) var, vec);
621  var_val vv;
622 
623  if(val == 0)
624  user_error("make_vvs_from_sc", "Value should not be equal to zero\n");
625 
626  /* We remove "var" from "vec" */
627  new_vec = vect_del_var(vec, (Variable) var);
628 
629  /* We have: val.var + new_vec == 0. So: abs(val).var = -sign(val).new_vec
630  */
631  if(val < 0)
632  val = 0-val;
633  else
634  vect_chg_sgn(new_vec);
635 
636 /*
637  vv_syn = syntax_undefined;
638  if(val != 1) {
639  vv_syn = make_syntax(is_syntax_call,
640  make_call(make_integer_constant_entity(val), NIL));
641  }
642  vv = make_var_val(var, make_expression(vv_syn,
643  make_normalized(is_normalized_linear,
644  new_vec)));
645 */
646  vv = MAKE_VV(var, val, new_vec);
647 
648  new_vvs = gen_nconc(new_vvs, CONS(VAR_VAL, vv, NIL));
649  }
650  return(new_vvs);
651 }
652 
653 
654 /* ======================================================================== */
655 /* list plc_make_vvs_with_vector(Pvecteur v): computes a substitution
656  * from a vector representing the following equality: v = 0
657  *
658  * We do a Gauss-Jordan elimination on "v", the equation is transformed into
659  * a substitution.
660  *
661  * For example, with the equation:
662  * C1 - C2 = 0
663  *
664  * we can eliminate one of the two variables C1 or C2), the substitution may
665  * be:
666  * C2 <-- C1
667  */
669 Pvecteur v;
670 {
671  list vvs = NIL, lc;
672  bool var_not_found;
673  entity crt_var = entity_undefined;
674  int crt_val = 0;
675  Pvecteur pv_elim;
676 
677  /* we sort the variables of this vector in order to try the elimination in
678  * the following order: first the CONST_COEFF, second the PARAM_COEFF,
679  * third the INDEX_COEFF, last the MU_COEFF.
680  */
681 
683 
684  /* We look, in lc, for a variable that we can eliminate in v, i.e. with a
685  * coefficient equal to 1 or -1.
686  */
687  var_not_found = true;
688  for(; (lc != NIL) && var_not_found; lc = CDR(lc)) {
689  crt_var = ENTITY(CAR(lc));
690  crt_val = (int) vect_coeff((Variable) crt_var, v);
691  if((crt_val == 1) || (crt_val == -1))
692  var_not_found = false;
693  }
694  if(! var_not_found) {
695  pv_elim = vect_cl2_ofl_ctrl((crt_val)*(-1), v, 1,
696  vect_new((Variable) crt_var, 1),
697  NO_OFL_CTRL);
698  vvs = make_vvs(crt_var, 1, pv_elim);
699  }
700 
701  if(get_debug_level() > 5) {
702  fprintf(stderr, "[plc_make_vvs_with_dist] \t\t\tDist vvs:\n");
703  fprint_vvs(stderr, vvs);
704  fprintf(stderr, "\n");
705  }
706 
707  return(vvs);
708 }
709 
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
void const char const char const int
int Value
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
#define newgen_Pvecteur(p)
Definition: compsec.h:26
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
Definition: list.c:436
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
list base_to_list(Pbase base)
Most includes are centralized here.
#define user_error(fn,...)
Definition: misc-local.h:265
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
Definition: newgen_types.h:78
list general_merge_sort(list, bool(*)(void))
Psysteme elim_var_with_eg(Psysteme, list *, list *)
===========================================================================
Definition: utils.c:1361
void pu_vect_fprint(FILE *, Pvecteur)
===========================================================================
Definition: print.c:446
void substitute_var_with_vec(Psysteme, entity, Value, Pvecteur)
===========================================================================
Definition: utils.c:1210
list vecteur_to_list(Pvecteur)
===========================================================================
Definition: utils.c:1626
bool pu_is_inferior_var(Variable, Variable)
Ppolynome prototype_var_subst(Ppolynome, Variable, Ppolynome)
=================================================================
Definition: utils.c:1978
#define var_val_value(x)
Definition: paf_ri.h:795
#define var_val_variable(x)
Definition: paf_ri.h:793
#define VAR_VAL(x)
VAR_VAL.
Definition: paf_ri.h:763
Ppolynome make_polynome(float coeff, Variable var, Value expo)
Ppolynome make_polynome(float coeff, Variable var, Value expo) PRIVATE allocates space for,...
Definition: pnome-alloc.c:100
Ppolynome vecteur_to_polynome(Pvecteur pv)
===========================================================================
Definition: pnome-bin.c:406
Pbase polynome_used_var(Ppolynome pp, int *is_inferior_var)
Pbase polynome_used_var(Ppolynome pp, bool *is_inferior_var()) PRIVATE Returns, in a Pbase,...
Definition: pnome-reduc.c:204
#define POLYNOME_NUL
#define polynome_succ(pp)
bool compare_coeff(chunk *c1, chunk *c2)
========================================================================
Definition: utils.c:161
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_undefined
Definition: ri.h:2761
#define syntax_undefined
Definition: ri.h:2676
#define expression_syntax(x)
Definition: ri.h:1247
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
Pvecteur vecteur
struct Scontrainte * succ
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
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_val(v)
#define vecteur_var(v)
#define NO_OFL_CTRL
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
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
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
Pvecteur vect_cl2_ofl_ctrl(Value x1, Pvecteur v1, Value x2, Pvecteur v2, int ofl_ctrl)
Pvecteur vect_cl2_ofl(Value x1, Pvecteur v1, Value x2, Pvecteur v2): allocation d'un vecteur v dont l...
Definition: binaires.c:204
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl)
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl): etape d'acculumulation...
Definition: binaires.c:128
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
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
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
#define VV_VAL_(x)
Definition: vvs.c:73
#define VV_VAR(x)
Name : substitution.c Package : prgm_mapping Author : Platonoff Alexis Date : 4 october 1993 Historic...
Definition: vvs.c:71
list dup_vvs(list vvs)
========================================================================
Definition: vvs.c:131
Ppolynome my_vecteur_to_polynome(Pvecteur pv)
Global variables
Definition: vvs.c:86
void fprint_vvs(FILE *fp, list vvs)
========================================================================
Definition: vvs.c:146
list sc_to_vvs(Psysteme sc, list var_l)
========================================================================
Definition: vvs.c:382
list compose_vvs(list vv1, list vv2)
========================================================================
Definition: vvs.c:274
bool vvs_faisabilite(list vvs)
========================================================================
Definition: vvs.c:449
#define VV_VAL(x)
Definition: vvs.c:74
list make_vvs_from_sc(Psysteme ps_aux, list var_l)
========================================================================
Definition: vvs.c:610
var_val dup_vv(var_val vv)
========================================================================
Definition: vvs.c:123
Psysteme vvs_to_sc(list vvs)
========================================================================
Definition: vvs.c:429
#define VV_COEFF(x)
Definition: vvs.c:72
list vvs_on_vvs(list vv1, list vv2)
========================================================================
Definition: vvs.c:198
Ppolynome vvs_on_polynome(list vvs, Ppolynome pp)
========================================================================
Definition: vvs.c:465
Psysteme vvs_on_systeme(list vvs, Psysteme ps)
========================================================================
Definition: vvs.c:567
void fprint_vv(FILE *fp, var_val vv)
========================================================================
Definition: vvs.c:158
bool(* argh)(Pvecteur *, Pvecteur *)
Definition: vvs.c:457
list plc_make_vvs_with_vector(Pvecteur v)
========================================================================
Definition: vvs.c:668
Pvecteur vvs_on_vecteur(list vvs, Pvecteur pv)
========================================================================
Definition: vvs.c:530
list make_vvs(entity var, int coeff, Pvecteur val)
========================================================================
Definition: vvs.c:113
#define MAKE_VV(var, coeff, val)
Definition: vvs.c:75