PIPS
comp_math.c
Go to the documentation of this file.
1 /*
2 
3  $Id: comp_math.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 /* comp_math.c
28  *
29  * "mathematical" operations on complexities
30  *
31  *
32  * complexity complexity_sigma(comp, index, clower, cupper)
33  * complexity_var_subst(comp, var, compsubst)
34  * complexity polynome_to_new_complexity(pp)
35  * complexity complexity_dup(comp)
36  * void complexity_rm(pcomp)
37  * complexity make_single_var_complexity(float, var)
38  * bool complexity_constant_p(comp)
39  * float complexity_TCST(comp)
40  * void complexity_scalar_mult(pcomp, f)
41  * void complexity_float_add(pcomp, f)
42  * void complexity_stats_add(pcomp1, comp2)
43  * void complexity_add(pcomp1, comp2)
44  * void complexity_sub(pcomp1, comp2)
45  * void complexity_mult(pcomp1, comp2)
46  * void complexity_polynome_add(pcomp, pp)
47  * Ppolynome complexity_polynome(comp)
48  * complexity replace_formal_parameters_by_real_ones(comp, mod, args, precond)
49  */
50 
51 /* Modif:
52  -- entity_local_name is replaced by module_local_name. LZ 230993
53 */
54 
55 #include <stdio.h>
56 #include <string.h>
57 
58 #include "linear.h"
59 
60 #include "genC.h"
61 #include "ri.h"
62 #include "effects.h"
63 #include "complexity_ri.h"
64 #include "ri-util.h"
65 #include "effects-util.h"
66 #include "misc.h"
67 #include "matrice.h"
68 #include "properties.h"
69 #include "complexity.h"
70 ␌
71 /* complexity complexity_sigma(complexity comp, Variable index,
72  * complexity clower, cupper)
73  * return the integration of complexity comp when the index
74  * is running between clower and cupper. Based on the polynomial
75  * library routine polynome_sigma.
76  * - comp is undefined => result undefined.
77  * - comp is null => result is null whatever the bounds are.
78  * - bound(s) is(are) undefined:
79  * if comp depends on the index, the result is undefined;
80  * else the result is comp * UNKNOWN_RANGE.
81  * - everything is defined: the result is the integration
82  * of the respective polynomials.
83  */
84 complexity complexity_sigma(comp, index, clower, cupper)
85 complexity comp;
86 Variable index;
87 complexity clower, cupper;
88 {
89  complexity cresult = make_zero_complexity();
90  Ppolynome ppsum;
91  Ppolynome pplower = POLYNOME_NUL;
92  Ppolynome ppupper = POLYNOME_NUL;
93 
94  if (COMPLEXITY_UNDEFINED_P(comp))
95  pips_internal_error("complexity undefined");
96 
97  if (complexity_zero_p(comp))
98  return (cresult);
99  else if ( COMPLEXITY_UNDEFINED_P(clower) ||
100  COMPLEXITY_UNDEFINED_P(cupper) ) {
102  (Variable)index) )
103  return (cresult);
104  else {
105  /* FI: Too late to build a meaningful unknown range name! */
106  /*
107  ppsum = make_polynome(1.0, UNKNOWN_RANGE, 1);
108  */
114  ppsum = make_polynome(1.0, (Variable) ur, VALUE_ONE);
115  cresult = polynome_to_new_complexity(ppsum); /*stats*/
116  complexity_mult(&cresult, comp);
117 
118  polynome_rm(&ppsum);
119  return(cresult);
120  }
121  }
122  else {
123  pplower = complexity_polynome(clower);
124  ppupper = complexity_polynome(cupper);
125 
126  if (false) {
127  fprintf(stderr, "summing ");
128  prp(complexity_polynome(comp));
129  fprintf(stderr, " %s running between ",
130  module_local_name((entity)index));
131  prp(pplower);
132  fprintf(stderr, " and ");
133  prp(ppupper);
134  fprintf(stderr, "\n");
135  }
136 
137  ppsum = polynome_sigma(complexity_polynome(comp),
138  (Variable) index,
139  pplower, ppupper);
140  cresult = polynome_to_new_complexity(ppsum);
141  complexity_stats_add(&cresult, comp);
142  complexity_stats_add(&cresult, clower);
143  complexity_stats_add(&cresult, cupper);
144 
145  polynome_rm(&ppsum);
146  return(cresult);
147  }
148 }
149 ␌
150 /* complexity complexity_var_subst(comp, var, compsubst)
151  * replaces every occurrence of variable var in complexity comp
152  * by the polynomial of complexity compsubst. The statistics
153  * of compsubst are added to those of comp.
154  */
155 complexity complexity_var_subst(comp, var, compsubst)
156 complexity comp;
157 Variable var;
158 complexity compsubst;
159 {
160  Ppolynome pp, ppsubst, ppresult;
161  complexity cresult = make_zero_complexity();
162 
163  if (COMPLEXITY_UNDEFINED_P(comp) || COMPLEXITY_UNDEFINED_P(compsubst))
164  pips_internal_error("complexity undefined");
165 
166  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
167  fprintf(stderr,"complexity_var_subst, variable name=%s\n",
168  variable_name(var) );
169  }
170 
171  if (complexity_zero_p(comp))
172  return (cresult);
173  else {
174  pp = complexity_polynome(comp);
175  ppsubst = complexity_polynome(compsubst);
176 
177  ppresult = polynome_var_subst(pp, var, ppsubst); /* substitutes */
178 
179  cresult = polynome_to_new_complexity(ppresult);
180  complexity_stats_add(&cresult, compsubst);
181 
182  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
183  (void) complexity_consistent_p(cresult);
184  fprintf(stderr,"complexity_var_subst, comp is ");
185  complexity_fprint(stderr, comp, false, true);
186  fprintf(stderr,"complexity_var_subst, compsubst is ");
187  complexity_fprint(stderr, compsubst, false, true);
188  fprintf(stderr,"complexity_var_subst, cresult is ");
189  complexity_fprint(stderr, cresult, false, true);
190  }
191  }
192 
193  return(cresult);
194 }
195 
196 ␌
197 /* Create a complexity equal to Ppolynome pp
198  * with null statistics. pp IS duplicated.
199  */
201 Ppolynome pp;
202 {
203  varcount vc = make_varcount(0,0,0,0);
204  rangecount rc = make_rangecount(0,0,0,0);
205  ifcount ic = make_ifcount(0,0,0);
206  Ppolynome ppdup;
207  complexity comp;
208 
209  pips_assert("polynome_to_new_complexity", !POLYNOME_UNDEFINED_P(pp));
210 
211  ppdup = polynome_dup(pp);
212  comp = make_complexity(ppdup, vc, rc, ic);
213  ifdebug(1) {
214  (void) complexity_consistent_p(comp);
215  }
216  return comp;
217 }
218 
219 /* make a complexity "f * var" with null statistics */
221 float f;
222 Variable var;
223 {
224  Ppolynome pp = make_polynome(f, var, VALUE_ONE);
226  polynome_rm(&pp);
227  return(comp);
228 }
229 
230 /* make a constant complexity "f * TCST" with null statistics */
232 float f;
233 {
235 }
236 
237 /* make a zero complexity "0.0000 * TCST" with null statistics */
239 {
240  return make_constant_complexity(0.0000);
241 }
242 
243 /* zero complexity check. Abort if undefined */
245 complexity comp;
246 {
247  if ( COMPLEXITY_UNDEFINED_P(comp) )
248  pips_internal_error("undefined complexity");
249 
251  return (true);
252  return (false);
253 }
254 
255 /* true if comp is constant. Abort if undefined */
257 complexity comp;
258 {
259  if ( COMPLEXITY_UNDEFINED_P(comp) )
260  pips_internal_error("undefined complexity");
261 
262  if ( complexity_zero_p(comp) )
263  return (true);
264  else
265  return (polynome_constant_p(complexity_eval(comp)));
266 }
267 
268 /* true if comp is unknown. Abort if undefined */
270 complexity comp;
271 {
272  if ( COMPLEXITY_UNDEFINED_P(comp) )
273  pips_internal_error("undefined complexity");
274 
275  /* FI: Management of unknown complexities, when polynomes are in
276  fact used to represent the value of a variables or an expression,
277  has to be revisited */
278  /*
279  if ( polynome_contains_var((Ppolynome)complexity_eval(comp),
280  UNKNOWN_RANGE) )
281  return (true);
282  else
283  */
284  return (false);
285 }
286 
287 /* return the constant term of comp. Abort if undefined */
288 float complexity_TCST(comp)
289 complexity comp;
290 {
291  if ( COMPLEXITY_UNDEFINED_P(comp) )
292  pips_internal_error("undefined complexity");
293 
294  if ( complexity_zero_p(comp) )
295  return ((float) 0);
296  else
297  return (polynome_TCST(complexity_eval(comp)));
298 }
299 
300 /* multiply a complexity by a floating-point number.
301  * Abort if undefined.
302  */
304 complexity *pcomp;
305 float f;
306 {
307  if ( COMPLEXITY_UNDEFINED_P(*pcomp) )
308  pips_internal_error("complexity undefined");
309 
310  if ( f == 0.00 ) {
311  complexity_rm(pcomp);
312  *pcomp = make_zero_complexity();
313  }
314  else if ( !complexity_zero_p(*pcomp) )
315  complexity_eval_(*pcomp) =
318 }
319 
320 /* Add comp2's statistics to *pcomp1's
321  * comp2 keeps unchanged
322  */
323 void complexity_stats_add(pcomp1, comp2)
324 complexity *pcomp1, comp2;
325 {
326  ifdebug (1) {
327  (void) complexity_consistent_p(*pcomp1);
328  (void) complexity_consistent_p(comp2);
329  }
330 
331  if ( COMPLEXITY_UNDEFINED_P(comp2) || COMPLEXITY_UNDEFINED_P(*pcomp1) )
332  pips_internal_error("complexity undefined");
333 
334  if ( complexity_zero_p(*pcomp1) ) {
335  *pcomp1 = complexity_dup(comp2);
336  complexity_eval_(*pcomp1) =
338  }
339  else if ( !complexity_zero_p(comp2) ) {
340  varcount vc1 = complexity_varcount(*pcomp1);
341  rangecount rc1 = complexity_rangecount(*pcomp1);
342  ifcount ic1 = complexity_ifcount(*pcomp1);
343  varcount vc2 = complexity_varcount(comp2);
344  rangecount rc2 = complexity_rangecount(comp2);
345  ifcount ic2 = complexity_ifcount(comp2);
346 
348  varcount_guessed(vc1) += varcount_guessed(vc2);
349  varcount_bounded(vc1) += varcount_bounded(vc2);
350  varcount_unknown(vc1) += varcount_unknown(vc2);
351 
356 
357  ifcount_profiled(ic1) += ifcount_profiled(ic2);
358  ifcount_computed(ic1) += ifcount_computed(ic2);
359  ifcount_halfhalf(ic1) += ifcount_halfhalf(ic2);
360  }
361 
362  ifdebug (1) {
363  (void) complexity_consistent_p(*pcomp1);
364  }
365 }
366 ␌
367 /* void complexity_add(complexity *pcomp1, comp2)
368  * performs *pcomp1 = *pcomp1 + comp2;
369  * !usage: complexity_add(&comp1, comp2);
370  * comp2 keeps unchanged
371  */
372 void complexity_add(pcomp1, comp2)
373 complexity *pcomp1, comp2;
374 {
375  if ( COMPLEXITY_UNDEFINED_P(comp2) || COMPLEXITY_UNDEFINED_P(*pcomp1) )
376  pips_internal_error("complexity undefined");
377 
378  if ( complexity_zero_p(*pcomp1) ) {
379  *pcomp1 = complexity_dup(comp2);
380  }
381  else if ( !complexity_zero_p(comp2) ) {
382  complexity_eval_(*pcomp1) =
384  complexity_eval(comp2)));
385  complexity_stats_add(pcomp1, comp2);
386  }
387 }
388 
389 /* void complexity_sub(complexity *pcomp1, comp2)
390  * performs *pcomp1 = *pcomp1 - comp2;
391  * !usage: complexity_sub(&comp1, comp2);
392  * comp2 keeps unchanged
393  */
394 void complexity_sub(pcomp1, comp2)
395 complexity *pcomp1, comp2;
396 {
397  if ( COMPLEXITY_UNDEFINED_P(comp2) || COMPLEXITY_UNDEFINED_P(*pcomp1) )
398  pips_internal_error("complexity undefined");
399 
400  if ( complexity_zero_p(*pcomp1) )
401  *pcomp1 = complexity_dup(comp2);
402  else if ( !complexity_zero_p(comp2) ) {
403  complexity_eval_(comp2) =
405  complexity_eval_(*pcomp1) =
407  complexity_eval(comp2)));
408  complexity_stats_add(pcomp1, comp2);
409  complexity_eval_(comp2) =
411  }
412 }
413 ␌
414 /* void complexity_mult(complexity *pcomp1, comp2)
415  * performs *pcomp1 = *pcomp1 * comp2;
416  * !usage: complexity_mult(&comp1, comp2);
417  */
418 void complexity_mult(pcomp1, comp2)
419 complexity *pcomp1, comp2;
420 {
421  if ( COMPLEXITY_UNDEFINED_P(comp2) || COMPLEXITY_UNDEFINED_P(*pcomp1) )
422  pips_internal_error("complexity undefined");
423 
424  if ( complexity_zero_p(comp2) ) {
425  complexity_rm(pcomp1);
426  *pcomp1 = make_zero_complexity();
427  }
428  else if ( !complexity_zero_p(*pcomp1) ) {
429  Ppolynome ppmult;
430 
431  ppmult = polynome_mult(complexity_eval(*pcomp1),
432  complexity_eval(comp2));
433  complexity_eval_(*pcomp1) =
435  /* (Ppolynome) complexity_eval(*pcomp1) = (Ppolynome) ppmult; */
436  complexity_eval_(*pcomp1) = newgen_Ppolynome(ppmult);
437  complexity_stats_add(pcomp1, comp2);
438  }
439 }
440 
441 /* void complexity_div(complexity *pcomp1, comp2)
442  * performs *pcomp1 = *pcomp1 / comp2;
443  * !usage: complexity_div(&comp1, comp2);
444  */
445 void complexity_div(pcomp1, comp2)
446 complexity *pcomp1, comp2;
447 {
448  if ( COMPLEXITY_UNDEFINED_P(comp2) || COMPLEXITY_UNDEFINED_P(*pcomp1) )
449  pips_internal_error("complexity undefined");
450 
451  if ( complexity_zero_p(comp2) ) {
452  pips_internal_error("complexity divider is zero");
453  }
454  else if ( !complexity_zero_p(*pcomp1) ) {
455  Ppolynome ppdiv;
456  ppdiv = polynome_div(complexity_eval(*pcomp1), complexity_eval(comp2));
457 /* polynome_rm(&(complexity_eval(*pcomp1))); */
458  complexity_eval_(*pcomp1) = newgen_Ppolynome(ppdiv);
459  complexity_stats_add(pcomp1, comp2);
460  }
461 }
462 
463 void complexity_polynome_add(pcomp, pp)
464 complexity *pcomp;
465 Ppolynome pp;
466 {
467  if ( COMPLEXITY_UNDEFINED_P(*pcomp) )
468  pips_internal_error("complexity undefined");
469  else if ( POLYNOME_UNDEFINED_P(pp) )
470  pips_internal_error("polynome undefined");
471  else {
472  complexity_eval_(*pcomp) =
474  }
475 }
476 ␌
477 /* Add a floating point digit to the complexity
478  * May 3, 91
479  */
481 complexity *pcomp;
482 float f;
483 {
484  if ( COMPLEXITY_UNDEFINED_P(*pcomp) )
485  pips_internal_error("complexity undefined");
486 
487  if ( complexity_zero_p(*pcomp) )
488  {
490  *pcomp = polynome_to_new_complexity(ppnew);
491  polynome_rm(&ppnew);
492  }
493  else
494  complexity_eval_(*pcomp) =
496  f));
497 }
498 
499 
500 /* Because complexity is composed of two elements,
501  * we use this function to get the first element : polynome
502  * Usage : complexity_polynome(complexity comp)
503  * you will get a pointer to the polynome
504  * May 3, 91 lz
505  */
507 complexity comp;
508 {
509  if ( COMPLEXITY_UNDEFINED_P(comp) )
510  pips_internal_error("complexity undefined");
511 
512  if ( complexity_zero_p(comp) )
513  return (POLYNOME_NUL);
514  else
515  return ((Ppolynome)complexity_eval(comp));
516 }
517 ␌
518 /* transform formal params into real ones (args) in complexity comp */
519 complexity replace_formal_parameters_by_real_ones(comp, mod, args, precond, effects_list)
520 complexity comp;
521 entity mod;
522 list args;
523 transformer precond;
524 list effects_list;
525 {
526  complexity cresult = complexity_dup(comp);
527  complexity carg, ctemp;
529  char *param_name;
530  int param_rank;
531  list argument;
532 
533  pips_assert("replace_formal_parameters_by_real_ones", entity_module_p(mod));
534 
535  FOREACH (ENTITY, param,decl) {
537 
538  /* print out the entity name for debugging purpose */
539  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
540  fprintf(stderr,"in REPLACE, entity name is %s\n",
541  entity_name(param));
542  }
543 
544  if (storage_formal_p(st)) {
545  /* if formal parameter... */
546  param_name = entity_name(param);
547  param_rank = formal_offset(storage_formal(st));
548 
549  argument = gen_nthcdr(param_rank-1,args);/* minus one because offsets start at 1 not 0 */
550 
551  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
552  fprintf(stderr,"formal offset=%d, formal name=%s\n",
553  param_rank, param_name);
554  }
555 
557  precond,
558  effects_list,
559  KEEP_SYMBOLS,
560  EXACT_VALUE);
561 
562  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
563  fprintf(stderr,"variable name is %s\n", variable_name((Variable)param) );
564  }
565 
566  ctemp = complexity_var_subst(cresult, (Variable)param, carg);
567  complexity_rm(&cresult);
568  cresult = complexity_dup(ctemp);
569  complexity_rm(&carg);
570  }
571  }
572 
573  return (cresult);
574 }
575 
576 /* return a pointer to the (i)th element of the list
577  * if i = 1, the pointer doesn't change at all.
578  */
579 list list_ith_element(thelist, ith)
580 list thelist;
581 int ith;
582 {
583  for( ; --ith > 0; thelist = CDR(thelist) ) {
584  pips_assert("list_ith_element", thelist != NIL);
585  }
586 
587  return (thelist);
588 }
rangecount make_rangecount(intptr_t a1, intptr_t a2, intptr_t a3, intptr_t a4)
varcount make_varcount(intptr_t a1, intptr_t a2, intptr_t a3, intptr_t a4)
ifcount make_ifcount(intptr_t a1, intptr_t a2, intptr_t a3)
Definition: complexity_ri.c:96
complexity make_complexity(Ppolynome a1, varcount a2, rangecount a3, ifcount a4)
Definition: complexity_ri.c:54
bool complexity_consistent_p(complexity p)
Definition: complexity_ri.c:27
#define VALUE_ONE
complexity expression_to_complexity_polynome(expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize)
Entry point routine of this file:
void complexity_add(complexity *pcomp1, complexity comp2)
void complexity_add(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 + comp2; !...
Definition: comp_math.c:372
void complexity_scalar_mult(complexity *pcomp, float f)
multiply a complexity by a floating-point number.
Definition: comp_math.c:303
void complexity_polynome_add(complexity *pcomp, Ppolynome pp)
Definition: comp_math.c:463
Ppolynome complexity_polynome(complexity comp)
Because complexity is composed of two elements, we use this function to get the first element : polyn...
Definition: comp_math.c:506
float complexity_TCST(complexity comp)
return the constant term of comp.
Definition: comp_math.c:288
void complexity_div(complexity *pcomp1, complexity comp2)
void complexity_div(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 / comp2; !...
Definition: comp_math.c:445
void complexity_float_add(complexity *pcomp, float f)
Add a floating point digit to the complexity May 3, 91.
Definition: comp_math.c:480
complexity replace_formal_parameters_by_real_ones(complexity comp, entity mod, list args, transformer precond, list effects_list)
transform formal params into real ones (args) in complexity comp
Definition: comp_math.c:519
bool complexity_constant_p(complexity comp)
true if comp is constant.
Definition: comp_math.c:256
list list_ith_element(list thelist, int ith)
return a pointer to the (i)th element of the list if i = 1, the pointer doesn't change at all.
Definition: comp_math.c:579
complexity make_zero_complexity()
make a zero complexity "0.0000 * TCST" with null statistics
Definition: comp_math.c:238
complexity complexity_var_subst(complexity comp, Variable var, complexity compsubst)
complexity complexity_var_subst(comp, var, compsubst) replaces every occurrence of variable var in co...
Definition: comp_math.c:155
complexity make_constant_complexity(float f)
make a constant complexity "f * TCST" with null statistics
Definition: comp_math.c:231
complexity complexity_sigma(complexity comp, Variable index, complexity clower, complexity cupper)
comp_math.c
Definition: comp_math.c:84
void complexity_stats_add(complexity *pcomp1, complexity comp2)
Add comp2's statistics to *pcomp1's comp2 keeps unchanged.
Definition: comp_math.c:323
void complexity_mult(complexity *pcomp1, complexity comp2)
void complexity_mult(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 * comp2; !...
Definition: comp_math.c:418
bool complexity_zero_p(complexity comp)
zero complexity check.
Definition: comp_math.c:244
void complexity_sub(complexity *pcomp1, complexity comp2)
void complexity_sub(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 - comp2; !...
Definition: comp_math.c:394
complexity polynome_to_new_complexity(Ppolynome pp)
Create a complexity equal to Ppolynome pp with null statistics.
Definition: comp_math.c:200
bool complexity_unknown_p(complexity comp)
true if comp is unknown.
Definition: comp_math.c:269
complexity make_single_var_complexity(float f, Variable var)
make a complexity "f * var" with null statistics
Definition: comp_math.c:220
void complexity_rm(complexity *pcomp)
remove complexity comp
Definition: comp_util.c:164
void complexity_fprint(FILE *fd, complexity comp, bool print_stats_p, bool print_local_names_p)
Definition: comp_util.c:217
complexity complexity_dup(complexity comp)
duplicates complexity comp
Definition: comp_util.c:131
void prp(Ppolynome pp)
Definition: comp_util.c:239
#define KEEP_SYMBOLS
defines for "expression_to_polynome" parameters
#define COMPLEXITY_UNDEFINED_P(c)
#define UNKNOWN_RANGE_NAME
pseudo-variable for default iteration number of a loop
#define EXACT_VALUE
#define ifcount_computed(x)
#define complexity_eval(x)
Definition: complexity_ri.h:92
#define rangecount_unknown(x)
#define varcount_guessed(x)
#define complexity_eval_(x)
Definition: complexity_ri.h:91
#define complexity_ifcount(x)
Definition: complexity_ri.h:98
#define ifcount_profiled(x)
#define newgen_Ppolynome(p)
Definition: complexity_ri.h:19
#define complexity_varcount(x)
Definition: complexity_ri.h:94
#define complexity_rangecount(x)
Definition: complexity_ri.h:96
#define rangecount_guessed(x)
#define varcount_symbolic(x)
#define varcount_unknown(x)
#define varcount_bounded(x)
#define rangecount_profiled(x)
#define ifcount_halfhalf(x)
#define rangecount_bounded(x)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
list gen_nthcdr(int n, const list lx)
caution: the first item is 0! was: return( (n<=0) ? l : gen_nthcdr( n-1, CDR( l ))) ; if n>gen_length...
Definition: list.c:700
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define pips_internal_error
Definition: misc-local.h:149
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
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 polynome_dup(Ppolynome pp)
Ppolynome polynome_dup(Ppolynome pp) creates and returns a copy of pp.
Definition: pnome-alloc.c:211
void polynome_rm(Ppolynome *ppp)
void polynome_rm(Ppolynome* ppp) frees space occupied by polynomial *ppp returns *ppp pointing to POL...
Definition: pnome-alloc.c:170
Ppolynome polynome_free(Ppolynome pp)
Ppolynome polynome_free(Ppolynome pp) frees space occupied by polynomial pp returns pp == POLYNOME_NU...
Definition: pnome-alloc.c:191
Ppolynome polynome_addition(Ppolynome pp, Ppolynome pp2)
Ppolynome polynome_addition(Ppolynome pp, Ppolynome pp2) pp = pp + pp2.
Definition: pnome-bin.c:195
Ppolynome polynome_div(Ppolynome pp1, Ppolynome pp2)
Ppolynome polynome_div(Ppolynome pp1, Ppolynome pp2) returns p = pp1 / pp2.
Definition: pnome-bin.c:381
Ppolynome polynome_mult(Ppolynome pp1, Ppolynome pp2)
Ppolynome polynome_mult(Ppolynome pp1, Ppolynome pp2) returns pp1 * pp2.
Definition: pnome-bin.c:287
float polynome_TCST(Ppolynome pp)
float polynome_TCST(Ppolynome pp) returns the constant term of polynomial pp.
Definition: pnome-reduc.c:156
Ppolynome polynome_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst)
Ppolynome polynome_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst) creates and returns a Ppo...
Definition: pnome-reduc.c:47
bool polynome_constant_p(Ppolynome pp)
bool polynome_constant_p(Ppolynome pp) return true if pp is a constant polynomial (including null pol...
Definition: pnome-reduc.c:180
bool polynome_contains_var(Ppolynome pp, Variable var)
bool polynome_contains_var(Ppolynome pp, Variable var) PRIVATE returns true if variable var is in pol...
Definition: pnome-reduc.c:238
Ppolynome polynome_scalar_addition(Ppolynome pp, float term)
Ppolynome polynome_scalar_addition(Ppolynome pp, float term) pp = pp + term !usage: pp = polynome_sca...
Definition: pnome-scal.c:101
Ppolynome polynome_scalar_multiply(Ppolynome pp, float factor)
Ppolynome polynome_scalar_multiply(Ppolynome pp, float factor) pp = factor * (pp) !...
Definition: pnome-scal.c:65
Ppolynome polynome_sigma(Ppolynome pp, Variable var, Ppolynome ppinf, Ppolynome ppsup)
Ppolynome polynome_sigma(Ppolynome pp, Variable var, Ppolynome ppinf, ppsup) returns the sum of pp wh...
Ppolynome polynome_opposed(Ppolynome pp)
Ppolynome polynome_opposed(Ppolynome pp); changes sign of polynomial pp.
Definition: pnome-unaires.c:59
#define POLYNOME_NUL
#define POLYNOME_UNDEFINED_P(pp)
#define POLYNOME_NUL_P(pp)
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
bool entity_module_p(entity e)
Definition: entity.c:683
basic MakeBasic(int)
END_EOLE.
Definition: type.c:128
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592
#define formal_offset(x)
Definition: ri.h:1408
@ is_basic_int
Definition: ri.h:571
#define storage_formal_p(x)
Definition: ri.h:2522
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_storage(x)
Definition: ri.h:2794
#define code_declarations(x)
Definition: ri.h:784
#define storage_formal(x)
Definition: ri.h:2524
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_name(x)
Definition: ri.h:2790
#define value_code(x)
Definition: ri.h:3067
#define entity_initial(x)
Definition: ri.h:2796
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * variable_name(Variable v)
polynome_ri.c
Definition: polynome_ri.c:73
#define ifdebug(n)
Definition: sg.c:47
Polymorphic argument.
Definition: printf-args.h:92
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: replace.c:135
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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