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

Go to the source code of this file.

Functions

void insert_ineq_begin_sc (Psysteme sc, Pcontrainte ineq)
 This function inserts the constraint ineq at the beginning of the system of inequalities of sc. More...
 
void insert_2ineq_end_sc (Psysteme sc, Pcontrainte ineq)
 This function inserts two constraints ineq and ineq->succ at the end of the system of inequalities of sc. More...
 
void insert_ineq_end_sc (Psysteme sc, Pcontrainte ineq)
 This function inserts one constraint ineq at the end of the system of inequalities of sc. More...
 
Psysteme sc_equation_add (Psysteme sc, Pcontrainte c)
 The basis of the constraint system is updated. More...
 
Psysteme sc_inequality_add (Psysteme sc, Pcontrainte c)
 
Psysteme sc_constraint_add (Psysteme sc, Pcontrainte c, bool equality)
 

Function Documentation

◆ insert_2ineq_end_sc()

void insert_2ineq_end_sc ( Psysteme  sc,
Pcontrainte  ineq 
)

This function inserts two constraints ineq and ineq->succ at the end of the system of inequalities of sc.

Definition at line 54 of file sc_insert_eq.c.

57 {
58  Pcontrainte pc;
59 
61  sc->inegalites=contrainte_dup(ineq);
62  (sc->inegalites)->succ = contrainte_dup(ineq->succ);
63  }
64  else {
65  for (pc = sc->inegalites;
67  pc=pc->succ);
68  pc->succ = contrainte_dup(ineq);
69  pc = pc->succ;
70  pc->succ = contrainte_dup(ineq->succ);
71  }
72  sc->nb_ineq +=2;
73 }
#define CONTRAINTE_UNDEFINED_P(c)
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73

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

Referenced by bound_distribution().

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

◆ insert_ineq_begin_sc()

void insert_ineq_begin_sc ( Psysteme  sc,
Pcontrainte  ineq 
)

This function inserts the constraint ineq at the beginning of the system of inequalities of sc.

Definition at line 40 of file sc_insert_eq.c.

43 {
44  Pcontrainte ineg;
45  ineg = contrainte_dup(ineq);
46  ineg->succ = sc->inegalites;
47  sc->inegalites = ineg;
48  sc->nb_ineq ++;
49 }

References contrainte_dup(), and Scontrainte::succ.

Referenced by bound_distribution(), and loop_basic_workchunk_to_workchunk().

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

◆ insert_ineq_end_sc()

void insert_ineq_end_sc ( Psysteme  sc,
Pcontrainte  ineq 
)

This function inserts one constraint ineq at the end of the system of inequalities of sc.

Definition at line 81 of file sc_insert_eq.c.

84 {
85  Pcontrainte pc;
86 
88  sc->inegalites=contrainte_dup(ineq);
89  }
90  else {
91  for (pc = sc->inegalites;
93  pc=pc->succ);
94  pc->succ = contrainte_dup(ineq);
95  }
96  sc->nb_ineq ++;
97 }

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

Referenced by constraint_distribution(), and converti_psysmin_psysmax().

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

◆ sc_constraint_add()

Psysteme sc_constraint_add ( Psysteme  sc,
Pcontrainte  c,
bool  equality 
)

maintain consistency, although it's expensive; how about a sc_update_base function? Or a proper sc_add_inegalite function?

Definition at line 115 of file sc_insert_eq.c.

116 {
117  Pbase old_basis;
118  Pbase new_basis;
119 
120  if(equality)
121  sc_add_egalite(sc,c);
122  else
123  sc_add_inegalite(sc,c);
124 
125  /* maintain consistency, although it's expensive; how about a
126  sc_update_base function? Or a proper sc_add_inegalite function? */
127  old_basis = sc->base;
128  sc->base = (Pbase) VECTEUR_NUL;
129  sc_creer_base(sc);
130  new_basis = sc->base;
131  sc->base = base_union(old_basis, new_basis);
132  sc->dimension = base_dimension(sc->base);
133  base_rm(new_basis);
134  base_rm(old_basis);
135 
136  return sc;
137 }
Pbase base_union(Pbase b1, Pbase b2)
Pbase base_union(Pbase b1, Pbase b2): compute a new basis containing all elements of b1 and all eleme...
Definition: base.c:428
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
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
struct Svecteur * Pbase
#define base_rm(b)
#define base_dimension(b)

References Ssysteme::base, base_dimension, base_rm, base_union(), Ssysteme::dimension, sc_add_egalite(), sc_add_inegalite(), sc_creer_base(), and VECTEUR_NUL.

Referenced by c_convex_effects_on_actual_parameter_forward_translation(), efficient_sc_check_inequality_feasibility(), expression_less_than_in_context(), sc_equation_add(), sc_inequality_add(), and transformer_constraint_add().

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

◆ sc_equation_add()

Psysteme sc_equation_add ( Psysteme  sc,
Pcontrainte  c 
)

The basis of the constraint system is updated.

If not, see sc_add_egalite()

Definition at line 101 of file sc_insert_eq.c.

102 {
103  sc = sc_constraint_add(sc, c, true);
104  return sc;
105 }
Psysteme sc_constraint_add(Psysteme sc, Pcontrainte c, bool equality)
Definition: sc_insert_eq.c:115

References sc_constraint_add().

Referenced by transformer_add_variable_incrementation(), transformer_convex_hulls(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_list_generic_transitive_closure(), and translate_global_value().

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

◆ sc_inequality_add()

Psysteme sc_inequality_add ( Psysteme  sc,
Pcontrainte  c 
)

Definition at line 108 of file sc_insert_eq.c.

109 {
110  sc = sc_constraint_add(sc, c, false);
111  return sc;
112 }

References sc_constraint_add().

Referenced by check_range_wrt_precondition(), and transformer_convex_hulls().

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