PIPS
sparse_sc.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void sys_matrice_index (Psysteme, Pbase, matrice, int, int)
 Warning! Do not modify this file that is automatically generated! More...
 
void matrice_index_sys (Psysteme, Pbase, matrice, int, int)
 void matrice_index_sys(Psysteme sc, Pbase base_index, matrice AG, int n, int m) replace the coefficients of the index variables in sc by their new coefficients in the matrix AG[m,n]. More...
 
void sc_to_matrices (Psysteme, Pbase, matrice, matrice, int, int)
 Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie constante B Le systeme est suppose ne pas contenir de constantes symboliques. More...
 
void matrices_to_sc (Psysteme, Pbase, matrice, matrice, int, int)
 
void loop_sc_to_matrices (Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
 Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie constante B Le systeme peut contenir des constantes symboliques. More...
 
void matrices_to_loop_sc (Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
 
void constraints_to_matrices (Pcontrainte, Pbase, Pmatrix, Pmatrix)
 ======================================================================= More...
 
void matrices_to_constraints (Pcontrainte *, Pbase, Pmatrix, Pmatrix)
 ======================================================================= More...
 
void constraints_with_sym_cst_to_matrices (Pcontrainte, Pbase, Pbase, Pmatrix, Pmatrix)
 ======================================================================= More...
 
void matrices_to_constraints_with_sym_cst (Pcontrainte *, Pbase, Pbase, Pmatrix, Pmatrix)
 ======================================================================= More...
 

Function Documentation

◆ constraints_to_matrices()

void constraints_to_matrices ( Pcontrainte  pc,
Pbase  b,
Pmatrix  A,
Pmatrix  B 
)

=======================================================================

Parameters
pcc

Definition at line 461 of file sys_matrice_conv.c.

465 {
466  int i,j;
467  Pvecteur pv;
468  Pcontrainte eq;
469  int n=0;
470 
471  for (eq = pc; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,n++);
472 
473  matrix_nulle(B);
474  matrix_nulle(A);
475 
476  for(eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++) {
477  for(pv = b, j=1; pv != NULL; pv = pv->succ, j++){
479  }
480  MATRIX_ELEM(B,i,1) = vect_coeff(0,eq->vecteur);
481  }
482 }
#define CONTRAINTE_UNDEFINED_P(c)
#define B(A)
Definition: iabrev.h:61
#define MATRIX_ELEM(matrix, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrix-local.h:80
void matrix_nulle(Pmatrix Z)
void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrix.c:293
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
Definition: pip__tab.h:25
Pvecteur vecteur
struct Scontrainte * succ
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
#define vecteur_var(v)
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 B, CONTRAINTE_UNDEFINED_P, eq, MATRIX_ELEM, matrix_nulle(), Scontrainte::succ, Svecteur::succ, vect_coeff(), Scontrainte::vecteur, and vecteur_var.

Referenced by extract_lattice(), region_sc_minimal(), and transformer_to_1D_lattice().

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

◆ constraints_with_sym_cst_to_matrices()

void constraints_with_sym_cst_to_matrices ( Pcontrainte  pc,
Pbase  index_base,
Pbase  const_base,
Pmatrix  A,
Pmatrix  B 
)

=======================================================================

void constraints_with_sym_cst_to_matrices(Pcontrainte pc, Pbase index_base const_base, matrice A B, int n m1 m2):

constructs the matrices "A" and "B" corresponding to the linear constraints "pc", so: A.ib + B1.cb + B2 = 0 <=> pc(ib, cb) = 0:

 B = ( B1 | B2 ), B2 of dimension (n,1).

The basis "ib" gives the variables of the linear system. The basis "cb" gives the symbolic constants of the linear system.

The matrices "A" and "B" are supposed to have been already allocated in memory, respectively of dimension (n, m1) and (n, m2).

"n" must be the exact number of constraints in "pc". "m1" must be the exact number of variables in "ib". "m2" must be equal to the number of symbolic constants (in "cb") PLUS ONE (the actual constant).

Parameters
pcc
index_basendex_base
const_baseonst_base

Definition at line 572 of file sys_matrice_conv.c.

576 {
577  int i,j;
578  Pcontrainte eq;
579  Pvecteur pv;
580  int n = 0;
581  int m2 = vect_size(const_base);
582  for (eq = pc; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,n++);
583  matrix_nulle(B);
584  matrix_nulle(A);
585 
586  for (eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++) {
587  for(pv = index_base, j=1; pv != NULL; pv = pv->succ, j++){
589  }
590  for(pv = const_base, j=1; pv != NULL; pv = pv->succ, j++){
592  }
594  }
595 }
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.

References B, CONTRAINTE_UNDEFINED_P, eq, MATRIX_ELEM, matrix_nulle(), Scontrainte::succ, Svecteur::succ, TCST, vect_coeff(), vect_size(), Scontrainte::vecteur, and vecteur_var.

Referenced by make_reindex().

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

◆ loop_sc_to_matrices()

void loop_sc_to_matrices ( Psysteme  ps,
Pbase  index_base,
Pbase  const_base,
matrice  A,
matrice  B,
int  n,
int  m1,
int  m2 
)

Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie constante B Le systeme peut contenir des constantes symboliques.

Dans ce cas, la base index_base ne doit contenir que les variables etant des indices de boucles et la base const_base les constantes symboliques. La matrice B represente toutes les contraintes sur les constantes.

Les parametres de la fonction :

Psysteme ps : systeme lineaire !int A[] : matrice !int B[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

Parameters
pss
index_basendex_base
const_baseonst_base
m11
m22

Definition at line 278 of file sys_matrice_conv.c.

284 {
285 
286  int i,j;
287  Pcontrainte eq;
288  Pvecteur pv;
289 
290  matrice_nulle(B,n,m2);
291  matrice_nulle(A,n,m1);
292 
293  for (eq = ps->inegalites,i=1;
295  eq=eq->succ,i++) {
296  for(pv = index_base, j=1; pv != NULL; pv = pv->succ, j++){
297  ACCESS(A,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
298  }
299  for(pv = const_base, j=1; pv != NULL; pv = pv->succ, j++){
300  ACCESS(B,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
301  }
302  ACCESS(B,n,i,m2) = vect_coeff(TCST,eq->vecteur);
303  }
304 
305 }
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
Pcontrainte inegalites
Definition: sc-local.h:71

References ACCESS, B, CONTRAINTE_UNDEFINED_P, eq, matrice_nulle(), Scontrainte::succ, Svecteur::succ, TCST, vect_coeff(), Scontrainte::vecteur, and vecteur_var.

Referenced by sc_image_computation().

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

◆ matrice_index_sys()

void matrice_index_sys ( Psysteme  sc,
Pbase  base_index,
matrice  AG,
int  n,
int  m 
)

void matrice_index_sys(Psysteme sc, Pbase base_index, matrice AG, int n, int m) replace the coefficients of the index variables in sc by their new coefficients in the matrix AG[m,n].

Modif: taken into account the order of system of constraints.

vect_chg_coeff(&pc->vecteur, pb->var, ACCESS(AG,m,m-i+1,j));

Obsolete code: this old code was implemented assumming the order of system of constraints had changed because of _dup version. Thanks to _copy version, it's now straight. However, there'll be an incompatiblity if exist some calls of this function (which is already obsolete since it uses matrice instead of matrix) outside hyperplane.c. changed by DN.

Parameters
scc
base_indexase_index
AGG

Definition at line 80 of file sys_matrice_conv.c.

86 {
87  Pcontrainte pc;
88  Pbase pb;
89  Pvecteur pv;
90  int i,j;
91  Value deno;
92 
93  deno = DENOMINATOR(AG);
94  for (pc = sc->inegalites, i=1; i<=m; pc = pc->succ, i++)
95  for (pb = base_index, j=1; j<=n; pb = pb->succ, j++)
96 
97  /* vect_chg_coeff(&pc->vecteur, pb->var, ACCESS(AG,m,m-i+1,j));*/
98  /* Obsolete code:
99  * this old code was implemented assumming the order of system of constraints
100  * had changed because of _dup version. Thanks to _copy version, it's now straight.
101  * However, there'll be an incompatiblity if exist some calls of this function
102  * (which is already obsolete since it uses matrice instead of matrix) outside hyperplane.c.
103  * changed by DN.
104  */
105  vect_chg_coeff(&pc->vecteur, pb->var, ACCESS(AG,m,i,j));
106 
107  if (value_gt(deno,VALUE_ONE))
108  for (pc = sc->inegalites, i=1; i<=m; pc = pc->succ, i++)
109  for (pv = pc->vecteur; pv != NULL; pv = pv->succ)
110  if (base_find_variable(base_index,pv->var)==VARIABLE_UNDEFINED)
111  value_product(pv->val,deno);
112 }
#define value_gt(v1, v2)
int Value
#define value_product(v, w)
#define VALUE_ONE
Variable base_find_variable(Pbase b, Variable v)
Variable base_find_variable(Pbase b, Variable v): returns variable v if variable v is one of b's elem...
Definition: base.c:155
#define DENOMINATOR(matrix)
int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix La combinaison *(&()) est...
Definition: matrice-local.h:93
Value val
Definition: vecteur-local.h:91
Variable var
Definition: vecteur-local.h:90
#define VARIABLE_UNDEFINED
Definition: vecteur-local.h:64
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

References ACCESS, base_find_variable(), DENOMINATOR, Svecteur::succ, Svecteur::val, value_gt, VALUE_ONE, value_product, Svecteur::var, VARIABLE_UNDEFINED, vect_chg_coeff(), and Scontrainte::vecteur.

Referenced by hyperplane(), and unimodular().

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

◆ matrices_to_constraints()

void matrices_to_constraints ( Pcontrainte pc,
Pbase  b,
Pmatrix  A,
Pmatrix  B 
)

=======================================================================

build the constant terme if it is not null

build a new vecteur if there is a null constant term

the constraints are in reverse order

Parameters
pcc

Definition at line 501 of file sys_matrice_conv.c.

505 {
506  Pcontrainte newpc = NULL;
507  int i, j;
508  Value cst, coeff, dena, denb;
509  int n = MATRIX_NB_LINES(A);
510  int m = MATRIX_NB_COLUMNS(A);
511 
512  dena = MATRIX_DENOMINATOR(A);
513  denb = MATRIX_DENOMINATOR(B);
514 
515  for (i=n;i>=1; i--) {
516  Pvecteur vect, pv;
517  Pcontrainte cp;
518  bool found = false;
519 
520  cp = contrainte_new();
521 
522  /* build the constant terme if it is not null */
523  cst = MATRIX_ELEM(B,i,1);
524  if (value_notzero_p(cst)) {
525  pv = vect_new(TCST, value_mult(dena,cst));
526  found = true;
527  }
528 
529  for (vect = b,j=1;j<=m;vect=vect->succ,j++) {
530  coeff = MATRIX_ELEM(A,i,j);
531  if (value_notzero_p(coeff)) {
532  if (found)
533  vect_chg_coeff(&pv, vecteur_var(vect),
534  value_mult(denb,coeff));
535  else {
536  /* build a new vecteur if there is a null constant term */
537  pv = vect_new(vecteur_var(vect),
538  value_mult(denb,coeff));
539  found = true;
540  }
541  }
542  }
543  /* the constraints are in reverse order */
544  cp->vecteur = pv;
545  cp->succ = newpc;
546  newpc = cp;
547  }
548  *pc = newpc;
549 }
#define value_notzero_p(val)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
#define MATRIX_NB_LINES(matrix)
Definition: matrix-local.h:87
#define MATRIX_NB_COLUMNS(matrix)
Definition: matrix-local.h:88
#define MATRIX_DENOMINATOR(matrix)
int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix
Definition: matrix-local.h:86
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
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

References B, contrainte_new(), cp, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, Svecteur::succ, TCST, value_mult, value_notzero_p, vect_chg_coeff(), vect_new(), and vecteur_var.

Referenced by extract_lattice(), and region_sc_minimal().

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

◆ matrices_to_constraints_with_sym_cst()

void matrices_to_constraints_with_sym_cst ( Pcontrainte pc,
Pbase  index_base,
Pbase  const_base,
Pmatrix  A,
Pmatrix  B 
)

=======================================================================

build the constant terme if it exists

build a new vecteur if there is not constant term

build a new vecteur if there is not constant term

Parameters
pcc
index_basendex_base
const_baseonst_base

Definition at line 621 of file sys_matrice_conv.c.

625 {
626  Pvecteur vect,pv=NULL;
627  Pcontrainte cp,newpc= NULL;
628  int i,j;
629  Value cst,coeff,dena,denb;
630  bool found ;
631  int n = MATRIX_NB_LINES(A);
632  int m1 = MATRIX_NB_COLUMNS(A);
633  int m2 = MATRIX_NB_COLUMNS(B);
634  dena = MATRIX_DENOMINATOR(A);
635  denb = MATRIX_DENOMINATOR(B);
636 
637  for (i=n;i>=1; i--) {
638  found = false;
639  cp = contrainte_new();
640 
641  /* build the constant terme if it exists */
642  cst = MATRIX_ELEM(B,i,m2);
643  if (value_notzero_p(cst)) {
644  pv = vect_new(TCST, value_mult(dena,cst));
645  found = true;
646  }
647 
648  vect = base_union(index_base, const_base);
649  for (j=1;j<=m1;vect=vect->succ,j++) {
650  coeff = MATRIX_ELEM(A,i,j);
651  if (value_notzero_p(coeff)) {
652  if (found)
653  vect_chg_coeff(&pv, vecteur_var(vect),
654  value_mult(denb,coeff));
655  else {
656  /* build a new vecteur if there is not constant term */
657  pv = vect_new(vecteur_var(vect),
658  value_mult(denb,coeff));
659  found = true;
660  }
661  }
662  }
663 
664  for (j=1;j<=m2-1;vect=vect->succ,j++) {
665  coeff = MATRIX_ELEM(B,i,j);
666  if (value_notzero_p(coeff)) {
667  if (found)
668  vect_chg_coeff(&pv, vecteur_var(vect),
669  value_mult(denb,coeff));
670  else {
671  /* build a new vecteur if there is not constant term */
672  pv = vect_new(vecteur_var(vect),
673  value_mult(denb,coeff));
674  found = true;
675  }
676  }
677  }
678  cp->vecteur = pv;
679  cp->succ = newpc;
680  newpc = cp;
681  }
682  *pc = newpc;
683 }
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

References B, base_union(), contrainte_new(), cp, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, Svecteur::succ, TCST, value_mult, value_notzero_p, vect_chg_coeff(), vect_new(), and vecteur_var.

+ Here is the call graph for this function:

◆ matrices_to_loop_sc()

void matrices_to_loop_sc ( Psysteme  ps,
Pbase  index_base,
Pbase  const_base,
matrice  A,
matrice  B,
int  n,
int  m1,
int  m2 
)

create the variables

ajout des variables supplementaires utiles

build the constant terme if it exists

build a new vecteur if there is not constant term

build a new vecteur if there is not constant term

Parameters
pss
index_basendex_base
const_baseonst_base
m11
m22

Definition at line 338 of file sys_matrice_conv.c.

343 {
344  Pvecteur vect,pv=NULL;
345  Pcontrainte cp,pc= NULL;
346  Pbase b;
347  int i,j;
348  Value cst,coeff,dena,denb;
349  bool trouve ;
350 
351  /* create the variables */
352 
353  if (index_base != BASE_NULLE)
354  ps->base = base_reversal(vect_dup(index_base));
355  else ps->base = VECTEUR_UNDEFINED;
356 
357  ps->dimension = vect_size(ps->base);
358 
359  /* ajout des variables supplementaires utiles */
360 
361  if (VECTEUR_NUL_P(ps->base)) {
362  Variable var = creat_new_var(ps);
363  ps->base = vect_new(var,VALUE_ONE);
364  ps->dimension++;
365  }
366 
367  for (b = ps->base,i =2; i<= m1; i++,b=b->succ)
368  if (VECTEUR_NUL_P(b->succ)) {
369  Variable var = creat_new_var(ps);
370  b->succ = vect_new(var,VALUE_ONE);
371  ps->dimension++;
372  }
373 
374  ps->base = vect_add(vect_dup(const_base),vect_dup(ps->base));
375 
376  ps->dimension += vect_size(const_base);
377 
378  for (b = ps->base,i =2; i<= m1+m2-1; i++,b=b->succ)
379  if (VECTEUR_NUL_P(b->succ)) {
380  Variable var = creat_new_var(ps);
381  b->succ = vect_new(var,VALUE_ONE);
382  ps->dimension++;
383  }
384 
385  dena = DENOMINATOR(A);
386  denb = DENOMINATOR(B);
387 
388  for (i=1;i<=n; i++)
389  { trouve = false;
390  cp = contrainte_new();
391 
392  /* build the constant terme if it exists */
393  cst = ACCESS(B,n,i,m2);
394 
395  if (value_notzero_p(cst)) {
396  pv = vect_new(TCST, value_mult(dena,cst));
397  trouve = true;
398  }
399 
400 
401  for (vect = ps->base,j=1;j<=m1;vect=vect->succ,j++) {
402  coeff = ACCESS(A,n,i,j);
403  if (value_notzero_p(coeff)) {
404  if (trouve)
405  vect_chg_coeff(&pv, vecteur_var(vect),
406  value_mult(denb,coeff));
407  else {
408  /* build a new vecteur if there is not constant term */
409  pv = vect_new(vecteur_var(vect), value_mult(denb,coeff));
410  trouve = true;
411  }
412  }
413  }
414 
415  for (j=1;j<=m2-1;vect=vect->succ,j++) {
416  coeff = ACCESS(B,n,i,j);
417  if (value_notzero_p(coeff)) {
418  if (trouve)
419  vect_chg_coeff(&pv, vecteur_var(vect),
420  value_mult(denb,coeff));
421  else {
422  /* build a new vecteur if there is not constant term */
423  pv = vect_new(vecteur_var(vect), value_mult(denb,coeff));
424  trouve = true;
425  }
426  }
427  }
428  cp->vecteur = pv;
429  cp->succ = pc;
430  pc = cp;
431  }
432 
433  ps->inegalites = pc;
434  ps->nb_ineq = n;
435  ps->egalites = NULL;
436  ps->nb_eq = 0;
437 
438 
439 }
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
Variable creat_new_var(Psysteme ps)
char * noms_var(int i): cette fonction convertit un numero de variable en chaine de caracteres
Definition: sc_var.c:102
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
int nb_ineq
Definition: sc-local.h:73
int nb_eq
Definition: sc-local.h:72
#define VECTEUR_UNDEFINED
#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 BASE_NULLE
MACROS SUR LES BASES.
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_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

References ACCESS, B, BASE_NULLE, base_reversal(), contrainte_new(), cp, creat_new_var(), DENOMINATOR, Svecteur::succ, TCST, value_mult, value_notzero_p, VALUE_ONE, vect_add(), vect_chg_coeff(), vect_dup(), vect_new(), vect_size(), VECTEUR_NUL_P, VECTEUR_UNDEFINED, and vecteur_var.

Referenced by sc_image_computation().

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

◆ matrices_to_sc()

void matrices_to_sc ( Psysteme  ps,
Pbase  base_index,
matrice  A,
matrice  B,
int  n,
int  m 
)

create the variables

ajout des variables supplementaires utiles

build the constant terme if it exists

build a new vecteur if there is not constant term

Parameters
pss
base_indexase_index

Definition at line 185 of file sys_matrice_conv.c.

190 {
191  Pvecteur vect,pv=NULL;
192  Pcontrainte cp,pc= NULL;
193  Pbase b;
194  int i,j;
195  Value cst,coeff,dena,denb;
196  bool trouve ;
197 
198  /* create the variables */
199 
200  ps->base = base_reversal(vect_dup(base_index));
201 
202  for (b = ps->base;!VECTEUR_UNDEFINED_P(b);b=b->succ,ps->dimension ++) ;
203 
204  /* ajout des variables supplementaires utiles */
205 
206  if (VECTEUR_NUL_P(ps->base)) {
207  Variable var = creat_new_var(ps);
208  ps->base = vect_new(var,VALUE_ONE);
209  }
210 
211  for (b = ps->base,i =2; i<= m; i++,b=b->succ)
212  if (VECTEUR_NUL_P(b->succ)) {
213  Variable var = creat_new_var(ps);
214  b->succ = vect_new(var,VALUE_ONE);
215  }
216 
217 
218  dena = DENOMINATOR(A);
219  denb = DENOMINATOR(B);
220 
221  for (i=1;i<=n; i++)
222  { trouve = false;
223  cp = contrainte_new();
224 
225  /* build the constant terme if it exists */
226  cst = ACCESS(B,n,i,1);
227  if (value_notzero_p(cst)) {
228  pv = vect_new(TCST, value_mult(dena,cst));
229  trouve = true;
230  }
231 
232  for (vect = ps->base,j=1;j<=m;vect=vect->succ,j++) {
233  coeff = ACCESS(A,n,i,j);
234  if (value_notzero_p(coeff)) {
235  if (trouve)
236  vect_chg_coeff(&pv, vecteur_var(vect),
237  value_mult(denb,coeff));
238  else { /* build a new vecteur if there is not constant term */
239  pv = vect_new(vecteur_var(vect),
240  value_mult(denb,coeff));
241  trouve = true;
242  }
243  }
244  }
245  cp->vecteur = pv;
246  cp->succ = pc;
247  pc = cp;
248  }
249 
250  ps->inegalites = pc;
251  ps->nb_ineq = n;
252  ps->egalites = NULL;
253  ps->nb_eq = 0;
254 
255 
256 }
#define VECTEUR_UNDEFINED_P(v)

References ACCESS, B, base_reversal(), contrainte_new(), cp, creat_new_var(), DENOMINATOR, Svecteur::succ, TCST, value_mult, value_notzero_p, VALUE_ONE, vect_chg_coeff(), vect_dup(), vect_new(), VECTEUR_NUL_P, VECTEUR_UNDEFINED_P, and vecteur_var.

+ Here is the call graph for this function:

◆ sc_to_matrices()

void sc_to_matrices ( Psysteme  ps,
Pbase  base_index,
matrice  A,
matrice  B,
int  n,
int  m 
)

Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie constante B Le systeme est suppose ne pas contenir de constantes symboliques.

Les parametres de la fonction :

Psysteme ps : systeme lineaire !int A[] : matrice !int B[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

Parameters
pss
base_indexase_index

Definition at line 134 of file sys_matrice_conv.c.

139 {
140  int i,j;
141  Pcontrainte eq;
142  Pvecteur pv;
143  matrice_nulle(B,n,1);
144  matrice_nulle(A,n,m);
145 
146  for (eq = ps->inegalites,i=1;
148  eq=eq->succ,i++) {
149  for(pv = base_index, j=1; pv != NULL; pv = pv->succ, j++){
150  ACCESS(A,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
151  }
152  ACCESS(B,n,i,1) = vect_coeff(0,eq->vecteur);
153  }
154 }

References ACCESS, B, CONTRAINTE_UNDEFINED_P, eq, matrice_nulle(), Scontrainte::succ, Svecteur::succ, vect_coeff(), Scontrainte::vecteur, and vecteur_var.

Referenced by make_primal().

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

◆ sys_matrice_index()

void sys_matrice_index ( Psysteme  sc,
Pbase  base_index,
matrice  A,
int  n,
int  m 
)

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/sparse_sc/sparse_sc-local.h instead, to add your own modifications. header file built by cproto sparse_sc-local.h cproto-generated files sys_matrice_conv.c

Warning! Do not modify this file that is automatically generated!

Corinne Ancourt void sys_matrice_index(Psysteme sc, Pbase base_index, matrice A, int n, int m) create the matrix A [m,n] made with the coefficients of the index variables

Parameters
scc
base_indexase_index

Definition at line 53 of file sys_matrice_conv.c.

60 {
61  Pcontrainte pc;
62  Pvecteur pv;
63  int i, j;
64 
65  matrice_nulle(A, m, n);
66  for (pc = sc->inegalites, i=1; pc != NULL; pc = pc->succ, i++)
67  for(pv = base_index, j=1; pv != NULL; pv = pv->succ, j++)
68  ACCESS(A,m,i,j) = vect_coeff(pv->var, pc->vecteur);
69 }

References ACCESS, matrice_nulle(), Scontrainte::succ, Svecteur::succ, Svecteur::var, vect_coeff(), and Scontrainte::vecteur.

Referenced by hyperplane(), and unimodular().

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