PIPS
matrix.h File Reference

Go to the source code of this file.

Data Structures

struct  Pmatrix
 package matrice More...
 

Macros

#define MATRIX_UNDEFINED   ((Pmatrix) NULL)
 
#define matrix_free(m)   (free(m), (m)=(Pmatrix) NULL)
 Allocation et desallocation d'une matrice. More...
 
#define MATRIX_ELEM(matrix, i, j)    ((matrix)->coefficients[(((j)-1)*((matrix)->number_of_lines))+((i)-1)])
 Macros d'acces aux elements d'une matrice. More...
 
#define MATRIX_DENOMINATOR(matrix)   ((matrix)->denominator)
 int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix More...
 
#define MATRIX_NB_LINES(matrix)   ((matrix)->number_of_lines)
 
#define MATRIX_NB_COLUMNS(matrix)   ((matrix)->number_of_columns)
 
#define matrix_triangular_inferieure_p(a)    matrix_triangular_p(a, true)
 bool matrix_triangular_inferieure_p(matrice a): test de triangularite de la matrice a More...
 
#define matrix_triangular_superieure_p(a)    matrix_triangular_p(a, false)
 bool matrix_triangular_superieure_p(matrice a, int n, int m): test de triangularite de la matrice a More...
 
#define SUB_MATRIX_ELEM(matrix, i, j, level)
 MATRIX_RIGHT_INF_ELEM Permet d'acceder des sous-matrices dont le coin infe'rieur droit (i.e. More...
 

Typedefs

typedef struct Pmatrix Smatrix
 

Functions

Pmatrix matrix_new (int, int)
 cproto-generated files More...
 
void matrix_rm (Pmatrix)
 
void matrix_determinant (Pmatrix, Value[])
 determinant.c More...
 
void matrix_sub_determinant (Pmatrix, int, int, Value[])
 
void matrix_hermite (Pmatrix, Pmatrix, Pmatrix, Pmatrix, Value *, Value *)
 hermite.c More...
 
int matrix_hermite_rank (Pmatrix)
 int matrix_hermite_rank(Pmatrix a): rang d'une matrice en forme de hermite More...
 
int matrix_dim_hermite (Pmatrix)
 Calcul de la dimension de la matrice de Hermite H. More...
 
void matrix_unimodular_triangular_inversion (Pmatrix, Pmatrix, bool)
 inversion.c More...
 
void matrix_diagonal_inversion (Pmatrix, Pmatrix)
 void matrix_diagonal_inversion(Pmatrix s,Pmatrix inv_s) calcul de l'inversion du matrice en forme reduite smith. More...
 
void matrix_triangular_inversion (Pmatrix, Pmatrix, bool)
 void matrix_triangular_inversion(Pmatrix h, Pmatrix inv_h,bool infer) calcul de l'inversion du matrice en forme triangulaire. More...
 
void matrix_general_inversion (Pmatrix, Pmatrix)
 void matrix_general_inversion(Pmatrix a; Pmatrix inv_a) calcul de l'inversion du matrice general. More...
 
void matrix_unimodular_inversion (Pmatrix, Pmatrix)
 void matrix_unimodular_inversion(Pmatrix u, Pmatrix inv_u) calcul de l'inversion de la matrice unimodulaire. More...
 
Valuematrix_elem_ref (Pmatrix, int, int)
 matrix.c More...
 
Value matrix_elem (Pmatrix, int, int)
 
void matrix_transpose (const Pmatrix, Pmatrix)
 void matrix_transpose(Pmatrix a, Pmatrix a_t): transpose an (nxm) rational matrix a into a (mxn) rational matrix a_t More...
 
void matrix_multiply (const Pmatrix, const Pmatrix, Pmatrix)
 void matrix_multiply(Pmatrix a, Pmatrix b, Pmatrix c): multiply rational matrix a by rational matrix b and store result in matrix c More...
 
void matrix_normalize (Pmatrix)
 void matrix_normalize(Pmatrix a) More...
 
void matrix_normalizec (Pmatrix)
 void matrix_normalizec(Pmatrix MAT): Normalisation des coefficients de la matrice MAT, i.e. More...
 
void matrix_swap_columns (Pmatrix, int, int)
 void matrix_swap_columns(Pmatrix a, int c1, int c2): exchange columns c1,c2 of an (nxm) rational matrix More...
 
void matrix_swap_rows (Pmatrix, int, int)
 void matrix_swap_rows(Pmatrix a, int r1, int r2): exchange rows r1 and r2 of an (nxm) rational matrix a More...
 
void matrix_assign (Pmatrix, Pmatrix)
 void matrix_assign(Pmatrix A, Pmatrix B) Copie de la matrice A dans la matrice B More...
 
bool matrix_equality (Pmatrix, Pmatrix)
 bool matrix_equality(Pmatrix A, Pmatrix B) test de l'egalite de deux matrices A et B; elles doivent avoir ete normalisees au prealable pour que le test soit mathematiquement exact More...
 
void matrix_nulle (Pmatrix)
 void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle More...
 
bool matrix_nulle_p (Pmatrix)
 bool matrix_nulle_p(Pmatrix Z): test de nullite de la matrice Z More...
 
bool matrix_diagonal_p (Pmatrix)
 bool matrix_diagonal_p(Pmatrix Z): test de nullite de la matrice Z More...
 
bool matrix_triangular_p (Pmatrix, bool)
 bool matrix_triangular_p(Pmatrix Z, bool inferieure): test de triangularite de la matrice Z More...
 
bool matrix_triangular_unimodular_p (Pmatrix, bool)
 bool matrix_triangular_unimodular_p(Pmatrix Z, bool inferieure) test de la triangulaire et unimodulaire de la matrice Z. More...
 
void matrix_substract (Pmatrix, Pmatrix, Pmatrix)
 void matrix_substract(Pmatrix a, Pmatrix b, Pmatrix c): substract rational matrix c from rational matrix b and store result in matrix a More...
 
void matrix_add (Pmatrix, Pmatrix, Pmatrix)
 a = b + c More...
 
void matrix_subtraction_column (Pmatrix, int, int, Value)
 void matrix_subtraction_column(Pmatrix MAT,int c1,int c2,int x): Soustrait x fois la colonne c2 de la colonne c1 Precondition: n > 0; m > 0; 0 < c1, c2 < m; Effet: c1[0..n-1] = c1[0..n-1] - x*c2[0..n-1]. More...
 
void matrix_subtraction_line (Pmatrix, int, int, Value)
 void matrix_subtraction_line(Pmatrix MAT,int r1,int r2,int x): Soustrait x fois la ligne r2 de la ligne r1 Precondition: n > 0; m > 0; 0 < r1, r2 < n; Effet: r1[0..m-1] = r1[0..m-1] - x*r2[0..m-1] More...
 
void matrix_uminus (Pmatrix, Pmatrix)
 void matrix_uminus(A, mA) More...
 
void matrix_fprint (FILE *, Pmatrix)
 matrix_io.c More...
 
void matrix_print (Pmatrix)
 void matrix_print(matrice a): print an (nxm) rational matrix More...
 
void matrix_fscan (FILE *, Pmatrix *, int *, int *)
 void matrix_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCII file accessible via file descriptor f; a is allocated as a function of its number of columns and rows, n and m. More...
 
void matrix_pr_quot (FILE *, Value, Value)
 
void matrix_smith (Pmatrix, Pmatrix, Pmatrix, Pmatrix)
 smith.c More...
 
int matrices_to_1D_lattice (Pmatrix, Pmatrix, int, int, int, Value *, Value *)
 Under the assumption A x = B, A[n,m] and B[n], compute the 1-D lattice for x_i of x[m] as. More...
 
int matrix_line_nnul (Pmatrix, int)
 sub-matrix.c More...
 
void matrix_perm_col (Pmatrix, int, int)
 void matrix_perm_col(Pmatrix MAT, int k, int level): Calcul de la matrice de permutation permettant d'amener la k-ieme ligne de la matrice MAT(1..n,1..m) a la ligne (level + 1). More...
 
void matrix_perm_line (Pmatrix, int, int)
 void matrix_perm_line(Pmatrix MAT, int k, int level): Calcul de la matrice de permutation permettant d'amener la k-ieme colonne de la sous-matrice MAT(1..n,1..m) a la colonne 'level + 1' (premiere colonne de la sous matrice MAT(level+1 ..n,level+1 ..m)). More...
 
void matrix_min (Pmatrix, int *, int *, int)
 void matrix_min(Pmatrix MAT, int * i_min, int * j_min, int level): Recherche des coordonnees (*i_min, *j_min) de l'element de la sous-matrice MAT(level+1 ..n, level+1 ..m) dont la valeur absolue est la plus petite et non nulle. More...
 
void matrix_maj_col (Pmatrix, Pmatrix, int)
 void matrix_maj_col(Pmatrix A, matrice P, int level): Calcul de la matrice permettant de remplacer chaque terme de la premiere ligne de la sous-matrice A(level+1 ..n, level+1 ..m) autre que le premier terme A11=A(level+1,level+1) par le reste de sa division entiere par A11 More...
 
void matrix_maj_line (Pmatrix, Pmatrix, int)
 void matrix_maj_line(Pmatrix A, matrice Q, int level): Calcul de la matrice permettant de remplacer chaque terme de la premiere ligne autre que le premier terme A11=A(level+1,level+1) par le reste de sa division entiere par A11 More...
 
void matrix_identity (Pmatrix, int)
 void matrix_identity(Pmatrix ID, int level) Construction d'une sous-matrice identity dans ID(level+1..n, level+1..n) More...
 
bool matrix_identity_p (Pmatrix, int)
 bool matrix_identity_p(Pmatrix ID, int level) test d'une sous-matrice dans ID(level+1..n, level+1..n) pour savoir si c'est une matrice identity. More...
 
int matrix_line_el (Pmatrix, int)
 int matrix_line_el(Pmatrix MAT, int level) renvoie le numero de colonne absolu du premier element non nul de la sous-ligne MAT(level+1,level+2..m); renvoie 0 si la sous-ligne est vide. More...
 
int matrix_col_el (Pmatrix, int)
 int matrix_col_el(Pmatrix MAT, int level) renvoie le numero de ligne absolu du premier element non nul de la sous-colonne MAT(level+2..n,level+1); renvoie 0 si la sous-colonne est vide. More...
 
void matrix_coeff_nnul (Pmatrix, int *, int *, int)
 void matrix_coeff_nnul(Pmatrix MAT, int * lg_nnul, int * cl_nnul, int level) renvoie les coordonnees du plus petit element non-nul de la premiere sous-ligne non nulle 'lg_nnul' de la sous-matrice MAT(level+1..n, level+1..m) More...
 
void ordinary_sub_matrix (Pmatrix, Pmatrix, int, int, int, int)
 void ordinary_sub_matrix(Pmatrix A, A_sub, int i1, i2, j1, j2) input : a initialized matrix A, an uninitialized matrix A_sub, which dimensions are i2-i1+1 and j2-j1+1. More...
 
void insert_sub_matrix (Pmatrix, Pmatrix, int, int, int, int)
 void insert_sub_matrix(A, A_sub, i1, i2, j1, j2) input: matrix A and smaller A_sub output: nothing modifies: A_sub is inserted in A at the specified position comment: A must be pre-allocated More...
 

Macro Definition Documentation

◆ MATRIX_DENOMINATOR

#define MATRIX_DENOMINATOR (   matrix)    ((matrix)->denominator)

int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix

Definition at line 94 of file matrix.h.

◆ MATRIX_ELEM

#define MATRIX_ELEM (   matrix,
  i,
 
)     ((matrix)->coefficients[(((j)-1)*((matrix)->number_of_lines))+((i)-1)])

Macros d'acces aux elements d'une matrice.

int MATRIX_ELEM(int * matrix, int i, int j): acces a l'element (i,j) de la matrice matrix.

Definition at line 88 of file matrix.h.

◆ matrix_free

#define matrix_free (   m)    (free(m), (m)=(Pmatrix) NULL)

Allocation et desallocation d'une matrice.

Definition at line 81 of file matrix.h.

◆ MATRIX_NB_COLUMNS

#define MATRIX_NB_COLUMNS (   matrix)    ((matrix)->number_of_columns)

Definition at line 96 of file matrix.h.

◆ MATRIX_NB_LINES

#define MATRIX_NB_LINES (   matrix)    ((matrix)->number_of_lines)

Definition at line 95 of file matrix.h.

◆ matrix_triangular_inferieure_p

#define matrix_triangular_inferieure_p (   a)     matrix_triangular_p(a, true)

bool matrix_triangular_inferieure_p(matrice a): test de triangularite de la matrice a

Definition at line 101 of file matrix.h.

◆ matrix_triangular_superieure_p

#define matrix_triangular_superieure_p (   a)     matrix_triangular_p(a, false)

bool matrix_triangular_superieure_p(matrice a, int n, int m): test de triangularite de la matrice a

Definition at line 107 of file matrix.h.

◆ MATRIX_UNDEFINED

#define MATRIX_UNDEFINED   ((Pmatrix) NULL)

Definition at line 78 of file matrix.h.

◆ SUB_MATRIX_ELEM

#define SUB_MATRIX_ELEM (   matrix,
  i,
  j,
  level 
)
Value:
(matrix->coefficients[((j)-1+(level))* \
((matrix)->number_of_lines) + (i) - 1 + (level)])
#define level

MATRIX_RIGHT_INF_ELEM Permet d'acceder des sous-matrices dont le coin infe'rieur droit (i.e.

le premier element) se trouve sur la diagonal

Definition at line 114 of file matrix.h.

Typedef Documentation

◆ Smatrix

typedef struct Pmatrix Smatrix

Function Documentation

◆ insert_sub_matrix()

void insert_sub_matrix ( Pmatrix  A,
Pmatrix  A_sub,
int  i1,
int  i2,
int  j1,
int  j2 
)

void insert_sub_matrix(A, A_sub, i1, i2, j1, j2) input: matrix A and smaller A_sub output: nothing modifies: A_sub is inserted in A at the specified position comment: A must be pre-allocated

Parameters
A_sub_sub
i11
i22
j11
j22

Definition at line 487 of file sub-matrix.c.

492 {
493  int i,j,i_sub,j_sub;
494 
495  assert(i1>=1 && j1>=1 &&
496  i2<=MATRIX_NB_LINES(A) && j2<=MATRIX_NB_COLUMNS(A) &&
497  i2-i1<MATRIX_NB_LINES(A_sub) && j2-j1<MATRIX_NB_COLUMNS(A_sub));
498 
499  for (i = i1, i_sub = 1; i <= i2; i++, i_sub ++)
500  for(j = j1, j_sub = 1; j <= j2; j++, j_sub ++)
501  MATRIX_ELEM(A,i,j) = MATRIX_ELEM(A_sub,i_sub,j_sub) ;
502 }
#define MATRIX_NB_LINES(matrix)
Definition: matrix-local.h:87
#define MATRIX_NB_COLUMNS(matrix)
Definition: matrix-local.h:88
#define MATRIX_ELEM(matrix, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrix-local.h:80
#define assert(ex)
Definition: newgen_assert.h:41
Definition: pip__tab.h:25

References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by extract_lattice().

+ Here is the caller graph for this function:

◆ matrices_to_1D_lattice()

int matrices_to_1D_lattice ( Pmatrix  A,
Pmatrix  B,
int  n,
int  m,
int  i,
Value gcd_p,
Value c_p 
)

Under the assumption A x = B, A[n,m] and B[n], compute the 1-D lattice for x_i of x[m] as.

x_i = gcd_i lambda + c_i

derived from the parametric solution of the system :

x_i = sum_{k<j<=m} q_{i,j} lambda_j + sum_{1<=j,=k} q_{i,j} y_c_{j}

where k is the rank of matrix A (0<=k<=n, k<=m), lambda_j are the free variables and y_c is the solution of the equations. This leads to:

gcd_i = sum_{k<j<=m} q_{i,j} and c_i = sum_{1<=j,=k} q_{i,j} y_c_{j}

when the system has a least one solution.

To compute Q and y_c, We use D[n,m], the Smith form of A, with D = P A Q and P[n,n] and Q[m,m] unimodular

inv(P) D inv(Q) x = b

inv(P) D y = b => D y = P b => some components of y[m] are constants, y_c[m]

y_c = D'{-1} P b, where D'[min(n,m),min(n,m)] is the top left submatrix of D[n,m]

y = inv(Q) x => x = Q (y_c[1..k],y[k+1..m])

where (a,b) represents s the concatenation of vectors a and b, and k<=min(n,m) the .

c_i = sum_j Q_{i,j} y_c_{j}

gcd = gcd_{j s.t. yc_j = 0} Q_{i,j}

Return false if the system Ax=b has no solution

This implements a partial parametric resolution of A x = B. It might be better from an engineering viewpoint to solve the system fully and then to exploit the equation for x_i.

Parameters
gcd_pcd_p
c_p_p

Definition at line 195 of file smith.c.

196 {
197  // The number of equations is smaller than the number of variables
198  // Not necessarily because you may have redundant equations
199  // assert(n<=m);
200  int success = 1;
201  Pmatrix P, D, Q;
202  P = matrix_new(n,n);
203  D = matrix_new(n,m);
204  Q = matrix_new(m,m);
205  matrix_smith(A,P,D,Q);
206 
207  // Compute P b
208 
209  Pmatrix Pb = matrix_new(n, 1);
210  matrix_multiply(P, B, Pb);
211 
212  // Compute yc by solving D yc = P b
213 
214  Pmatrix yc = matrix_new(m, 1);
215  int j;
216  for(j=1; j <= m; j++)
217  MATRIX_ELEM(yc, j, 1) = VALUE_ZERO;
218  // FI: it might be sufficient to check the pseudo-diagonal element Dii
219  int k = 0;
220  for(j=1; j <= n && j <= m; j++) {
221  Value Pbj = MATRIX_ELEM(Pb, j, 1);
222  if(!value_zero_p(Pbj)) {
223  Value Djj = MATRIX_ELEM(D, j, j);
224  if(!value_zero_p(Djj)) {
225  Value r = modulo(Pbj, Djj);
226  if(value_zero_p(r))
227  MATRIX_ELEM(yc, j, 1) = DIVIDE(Pbj, Djj), k=j;
228  else
229  success = false;
230  }
231  }
232  }
233  for(j=k+1; j <= n; j++) {
234  Value Pbj = MATRIX_ELEM(Pb, j, 1);
235  if(!value_zero_p(Pbj)) {
236  success = false;
237  }
238  }
239 
240  // If the system has parametric solutions
241 
242  if(success) {
243  // k = MIN(n,m);
244  // Compute the constant term "c_i"
245  *c_p = VALUE_ZERO;
246  for(j=1; j <= k; j++) {
247  *c_p += value_mult(MATRIX_ELEM(Q, i, j), MATRIX_ELEM(yc, j, 1));
248  }
249 
250  // and the gcd "gcd_i" with x = Q yc
251  *gcd_p = VALUE_ZERO;
252  for(j=k+1; j <= m; j++) {
253  if(value_zero_p(*gcd_p))
254  *gcd_p = MATRIX_ELEM(Q, i, j);
255  else if(!value_zero_p(MATRIX_ELEM(Q, i, j)))
256  *gcd_p = pgcd(*gcd_p, MATRIX_ELEM(Q, i, j));
257  }
258 
259  // With no information at all, the gcd default value is one
260  if(value_zero_p(*gcd_p))
261  *gcd_p = VALUE_ONE;
262  *c_p = modulo(*c_p, *gcd_p);
263  }
264  free(P);
265  free(Pb);
266  free(D);
267  free(Q);
268  free(yc);
269  return success;
270 }
#define VALUE_ZERO
#define modulo(a, b)
#define DIVIDE(x, y)
division avec reste toujours positif basee sur les equations: a/(-b) = - (a/b) (-a)/b = - ((a+b-1)/b)...
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
#define value_zero_p(val)
int Value
#define VALUE_ONE
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
void free(void *)
bool success
Definition: gpips-local.h:59
#define B(A)
Definition: iabrev.h:61
#define D(A)
Definition: iabrev.h:56
Pmatrix matrix_new(int m, int n)
package matrix
Definition: alloc.c:41
void matrix_smith(Pmatrix MAT, Pmatrix P, Pmatrix D, Pmatrix Q)
void matrix_smith(matrice MAT, matrix P, matrix D, matrix Q): Calcul de la forme reduite de Smith D d...
Definition: smith.c:68
void matrix_multiply(const Pmatrix a, const Pmatrix b, Pmatrix c)
void matrix_multiply(Pmatrix a, Pmatrix b, Pmatrix c): multiply rational matrix a by rational matrix ...
Definition: matrix.c:95
#define Q
Definition: pip__type.h:39
package matrice
Definition: matrix-local.h:63

References B, D, DIVIDE, free(), MATRIX_ELEM, matrix_multiply(), matrix_new(), matrix_smith(), modulo, pgcd, Q, value_mult, VALUE_ONE, VALUE_ZERO, and value_zero_p.

Referenced by transformer_to_1D_lattice().

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

◆ matrix_add()

void matrix_add ( Pmatrix  a,
Pmatrix  b,
Pmatrix  c 
)

a = b + c

precondition

Definition at line 471 of file matrix.c.

472 {
473  /* precondition */
474  int m = MATRIX_NB_LINES(a);
475  int n = MATRIX_NB_COLUMNS(a);
476  assert(n>0 && m>0);
479 
480  Value d1 = MATRIX_DENOMINATOR(b);
481  Value d2 = MATRIX_DENOMINATOR(c);
482  if (value_eq(d1,d2)){
483  int i, j;
484  for (i=1; i<=m; i++)
485  for (j=1; j<=n; j++)
486  MATRIX_ELEM(a,i,j) =
487  value_plus(MATRIX_ELEM(b,i,j),MATRIX_ELEM(c,i,j));
488  MATRIX_DENOMINATOR(a) = d1;
489  }
490  else{
491  Value lcm = ppcm(d1, d2);
492  d1 = value_div(lcm,d1);
493  d2 = value_div(lcm,d2);
494  int i, j;
495  for (i=1; i<=m; i++) {
496  for (j=1; j<=n; j++) {
497  Value t1 = value_mult(MATRIX_ELEM(b,i,j),d1);
498  Value t2 = value_mult(MATRIX_ELEM(c,i,j),d2);
499  MATRIX_ELEM(a,i,j) = value_plus(t1,t2);
500  }
501  }
502  MATRIX_DENOMINATOR(a) = lcm;
503  }
504 }
#define value_pos_p(val)
#define value_eq(v1, v2)
bool operators on values
#define value_plus(v1, v2)
binary operators on values
#define value_div(v1, v2)
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
#define MATRIX_DENOMINATOR(matrix)
int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix
Definition: matrix-local.h:86

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, ppcm(), value_div, value_eq, value_mult, value_plus, and value_pos_p.

Referenced by make_reindex(), and prepare_reindexing().

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

◆ matrix_assign()

void matrix_assign ( Pmatrix  A,
Pmatrix  B 
)

void matrix_assign(Pmatrix A, Pmatrix B) Copie de la matrice A dans la matrice B

Les parametres de la fonction :

int A[] : matrice !int B[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

Ancien nom: matrix_dup

Definition at line 259 of file matrix.c.

260 {
261  int m = MATRIX_NB_LINES(A);
262  int n = MATRIX_NB_COLUMNS(A);
263  int i;
264  for (i=0 ; i<m*n; i++)
265  B->coefficients[i] = A->coefficients[i];
266 }

References B, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by matrix_hermite(), matrix_smith(), sc_resol_smith(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_coeff_nnul()

void matrix_coeff_nnul ( Pmatrix  MAT,
int lg_nnul,
int cl_nnul,
int  level 
)

void matrix_coeff_nnul(Pmatrix MAT, int * lg_nnul, int * cl_nnul, int level) renvoie les coordonnees du plus petit element non-nul de la premiere sous-ligne non nulle 'lg_nnul' de la sous-matrice MAT(level+1..n, level+1..m)

recherche de la premiere ligne non nulle de la sous-matrice MAT(level+1 .. n,level+1 .. m)

recherche du plus petit (en valeur absolue) element non nul de cette ligne

Parameters
MATAT
lg_nnulg_nnul
cl_nnull_nnul
levelevel

Definition at line 421 of file sub-matrix.c.

425 {
426  bool trouve = false;
427  int j;
429  int m = MATRIX_NB_COLUMNS(MAT);
430  *lg_nnul = 0;
431  *cl_nnul = 0;
432 
433  /* recherche de la premiere ligne non nulle de la
434  sous-matrice MAT(level+1 .. n,level+1 .. m) */
435 
436  *lg_nnul= matrix_line_nnul(MAT,level);
437 
438  /* recherche du plus petit (en valeur absolue) element non nul de cette ligne */
439  if (*lg_nnul) {
440  for (j=1+level;j<=m && !trouve; j++) {
441  min = MATRIX_ELEM(MAT,*lg_nnul,j);
442  min = value_abs(min);
443  if (value_notzero_p(min)) {
444  trouve = true;
445  *cl_nnul=j;
446  }
447  }
448  for (j=1+level;j<=m && value_gt(min,VALUE_ONE); j++) {
449  val = MATRIX_ELEM(MAT,*lg_nnul,j);
450  val = value_abs(val);
451  if (value_notzero_p(val) && value_lt(val,min)) {
452  min = val;
453  *cl_nnul =j;
454  }
455  }
456  }
457 }
#define value_gt(v1, v2)
#define value_notzero_p(val)
#define value_abs(val)
#define value_lt(v1, v2)
#define min(a, b)
int matrix_line_nnul(Pmatrix MAT, int level)
int matrix_line_nnul(matrice MAT,int level): Recherche de la premiere ligne non nulle de la la sous-m...
Definition: sub-matrix.c:72

References level, MATRIX_ELEM, matrix_line_nnul(), MATRIX_NB_COLUMNS, min, value_abs, value_gt, value_lt, value_notzero_p, VALUE_ONE, and VALUE_ZERO.

Referenced by matrix_hermite().

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

◆ matrix_col_el()

int matrix_col_el ( Pmatrix  MAT,
int  level 
)

int matrix_col_el(Pmatrix MAT, int level) renvoie le numero de ligne absolu du premier element non nul de la sous-colonne MAT(level+2..n,level+1); renvoie 0 si la sous-colonne est vide.

RGSUSED

Parameters
MATAT
levelevel

Definition at line 401 of file sub-matrix.c.

404 {
405  int i;
406  int i_min=0;
407  int n = MATRIX_NB_LINES(MAT);
408  for(i = level+2; i <= n && (MATRIX_ELEM(MAT,i,level+1)==0); i++);
409  if (i<n+1)
410  i_min = i-1;
411  return (i_min);
412 }

References level, MATRIX_ELEM, and MATRIX_NB_LINES.

Referenced by matrix_smith(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_determinant()

void matrix_determinant ( Pmatrix  ,
Value  [] 
)

determinant.c

◆ matrix_diagonal_inversion()

void matrix_diagonal_inversion ( Pmatrix  s,
Pmatrix  inv_s 
)

void matrix_diagonal_inversion(Pmatrix s,Pmatrix inv_s) calcul de l'inversion du matrice en forme reduite smith.

s est un matrice de la forme reduite smith, inv_s est l'inversion de s ; telles que s * inv_s = I.

les parametres de la fonction : matrice s : matrice en forme reduite smith – input int n : dimension de la matrice caree – input matrice inv_s : l'inversion de s – output

tests des preconditions

calcul de la ppcm(s[1,1],s[2,2],...s[n,n])

Parameters
inv_snv_s

Definition at line 93 of file inversion.c.

96 {
97  Value d, d1;
98  Value gcd, lcm;
99  int i;
100  int n = MATRIX_NB_LINES(s);
101  /* tests des preconditions */
105 
106  matrix_nulle(inv_s);
107  /* calcul de la ppcm(s[1,1],s[2,2],...s[n,n]) */
108  lcm = MATRIX_ELEM(s,1,1);
109  for (i=2; i<=n; i++)
110  lcm = ppcm(lcm,MATRIX_ELEM(s,i,i));
111 
112  d = MATRIX_DENOMINATOR(s);
113  gcd = pgcd(lcm,d);
114  d1 = value_div(d,gcd);
115  for (i=1; i<=n; i++) {
116  Value tmp = value_div(lcm,MATRIX_ELEM(s,i,i));
117  MATRIX_ELEM(inv_s,i,i) = value_mult(d1,tmp);
118  }
119  MATRIX_DENOMINATOR(inv_s) = value_div(lcm,gcd);
120 }
int matrix_hermite_rank(Pmatrix a)
int matrix_hermite_rank(Pmatrix a): rang d'une matrice en forme de hermite
Definition: hermite.c:174
void matrix_nulle(Pmatrix Z)
void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrix.c:293
bool matrix_diagonal_p(Pmatrix Z)
bool matrix_diagonal_p(Pmatrix Z): test de nullite de la matrice Z
Definition: matrix.c:336

References assert, MATRIX_DENOMINATOR, matrix_diagonal_p(), MATRIX_ELEM, matrix_hermite_rank(), MATRIX_NB_LINES, matrix_nulle(), pgcd, ppcm(), value_div, value_mult, and value_pos_p.

+ Here is the call graph for this function:

◆ matrix_diagonal_p()

bool matrix_diagonal_p ( Pmatrix  Z)

bool matrix_diagonal_p(Pmatrix Z): test de nullite de la matrice Z

QQ i dans [1..n] QQ j dans [1..n] Z(i,j) == 0 && i != j || i == j

Les parametres de la fonction :

int Z[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

Definition at line 336 of file matrix.c.

337 {
338  int i,j;
339  int m = MATRIX_NB_LINES(Z);
340  int n = MATRIX_NB_COLUMNS(Z);
341  for (i=1;i<=m;i++)
342  for (j=1;j<=n;j++)
343  if(i!=j && MATRIX_ELEM(Z,i,j)!=0)
344  return false;
345  return true;
346 }

References MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by extract_lattice(), and matrix_diagonal_inversion().

+ Here is the caller graph for this function:

◆ matrix_dim_hermite()

int matrix_dim_hermite ( Pmatrix  H)

Calcul de la dimension de la matrice de Hermite H.

La matrice de Hermite est une matrice tres particuliere, pour laquelle il est tres facile de calculer sa dimension. Elle est egale au nombre de colonnes non nulles de la matrice.

Definition at line 194 of file hermite.c.

196 {
197  int i,j;
198  bool trouve_j = false;
199  int res=0;
200  int n = MATRIX_NB_LINES(H);
201  int m = MATRIX_NB_COLUMNS(H);
202  for (j = 1; j<=m && !trouve_j;j++) {
203  for (i=1; i<= n && MATRIX_ELEM(H,i,j) == 0; i++);
204  if (i>n) {
205  trouve_j = true;
206  res= j-1;
207  }
208  }
209 
210 
211  if (!trouve_j && m>=1) res = m;
212  return (res);
213 
214 }

References MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

◆ matrix_elem()

Value matrix_elem ( Pmatrix  M,
int  r,
int  c 
)

Definition at line 49 of file matrix.c.

50 {
51  assert(M != NULL && M->coefficients != NULL);
52  assert(1 <= r && r <= M->number_of_lines);
53  assert(1 <= c && c <= M->number_of_columns);
54  // return M->coefficients[(c-1) * M->number_of_lines + r - 1];
55  return MATRIX_ELEM(M, r, c);
56 }
Value * coefficients
Definition: matrix-local.h:67

References assert, Pmatrix::coefficients, and MATRIX_ELEM.

◆ matrix_elem_ref()

Value* matrix_elem_ref ( Pmatrix  M,
int  r,
int  c 
)

matrix.c

matrix.c

Definition at line 41 of file matrix.c.

42 {
43  assert(M != NULL && M->coefficients != NULL);
44  assert(1 <= r && r <= M->number_of_lines);
45  assert(1 <= c && c <= M->number_of_columns);
46  return &(MATRIX_ELEM(M, r, c));
47 }

References assert, Pmatrix::coefficients, and MATRIX_ELEM.

◆ matrix_equality()

bool matrix_equality ( Pmatrix  A,
Pmatrix  B 
)

bool matrix_equality(Pmatrix A, Pmatrix B) test de l'egalite de deux matrices A et B; elles doivent avoir ete normalisees au prealable pour que le test soit mathematiquement exact

Definition at line 273 of file matrix.c.

274 {
275  int m = MATRIX_NB_LINES(A);
276  int n = MATRIX_NB_COLUMNS(A);
277  int i;
278  for (i = 0 ; i < m*n; i++)
279  if (B->coefficients[i] != A->coefficients[i])
280  return false;
281  return true;
282 }

References B, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

◆ matrix_fprint()

void matrix_fprint ( FILE *  f,
Pmatrix  a 
)

matrix_io.c

matrix_io.c

void matrix_fprint(File * f, matrix a): print a rational matrix

Note: the output format is compatible with matrix_fscan()

Definition at line 44 of file matrix_io.c.

45 {
46  int i, j;
47  int m = MATRIX_NB_LINES(a);
48  int n = MATRIX_NB_COLUMNS(a);
50 
51  (void) fprintf(f, "%d %d\n", m, n);
52  (void) fprint_Value(f, MATRIX_DENOMINATOR(a));
53  (void) fprintf(f, "\n");
54  for(i=1; i<=m; i++) {
55  for(j=1; j<=n; j++) {
56  // matrix_pr_quot(f, MATRIX_ELEM(a,i,j), MATRIX_DENOMINATOR(a));
57  fprint_Value(f, MATRIX_ELEM(a,i,j));
58  fprintf(f, " ");
59  }
60  (void) fprintf(f, "\n");
61  }
62 }
void fprint_Value(FILE *, Value)
Definition: io.c:42
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References assert, f(), fprint_Value(), fprintf(), MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, and VALUE_ZERO.

Referenced by main(), make_reindex(), matrix_print(), and prepare_reindexing().

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

◆ matrix_fscan()

void matrix_fscan ( FILE *  f,
Pmatrix a,
int n,
int m 
)

void matrix_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCII file accessible via file descriptor f; a is allocated as a function of its number of columns and rows, n and m.

Format:

n m denominator a[1,1] a[1,2] ... a[1,m] a[2,1] ... a[2,m] ... a[n,m]

After the two dimensions and the global denominator, the matrix as usually displayed, line by line. Line feed can be used anywhere. Example for a (2x3) integer matrix: 2 3 1 1 2 3 4 5 6 row size

number of read elements

read dimensions

allocate a

read denominator

necessaires pour eviter les divisions par zero

pour "normaliser" un peu les representations

Parameters
mFormat:

n m denominator a[1,1] a[1,2] ... a[1,m] a[2,1] ... a[2,m] ... a[n,m]

After the two dimensions and the global denominator, the matrix as usually displayed, line by line. Line feed can be used anywhere. Example for a (2x3) integer matrix: 2 3 1 1 2 3 4 5 6 column size

Definition at line 93 of file matrix_io.c.

98 {
99  int r;
100  int c;
101 
102  /* number of read elements */
103  int n_read;
104 
105  /* read dimensions */
106  n_read = fscanf(f,"%d%d", n, m);
107  assert(n_read==2);
108  assert(1 <= *n && 1 <= *m);
109 
110  /* allocate a */
111  *a = matrix_new(*n,*m);
112 
113  /* read denominator */
114  n_read = fscan_Value(f,&(MATRIX_DENOMINATOR(*a)));
115  assert(n_read == 1);
116  /* necessaires pour eviter les divisions par zero */
118  /* pour "normaliser" un peu les representations */
120 
121  for(r = 1; r <= *n; r++)
122  for(c = 1; c <= *m; c++) {
123  n_read = fscan_Value(f, &MATRIX_ELEM(*a,r,c));
124  assert(n_read == 1);
125  }
126 }
int fscan_Value(FILE *, Value *)
Definition: io.c:58

References assert, f(), fscan_Value(), MATRIX_DENOMINATOR, MATRIX_ELEM, matrix_new(), value_notzero_p, and value_pos_p.

Referenced by Hierarchical_tiling(), main(), Tiling2_buffer(), and Tiling_buffer_allocation().

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

◆ matrix_general_inversion()

void matrix_general_inversion ( Pmatrix  a,
Pmatrix  inv_a 
)

void matrix_general_inversion(Pmatrix a; Pmatrix inv_a) calcul de l'inversion du matrice general.

Algorithme : calcul P, Q, H telque : PAQ = H ; -1 -1 si rank(H) = n ; A = Q H P .

les parametres de la fonction : matrice a : matrice general -— input matrice inv_a : l'inversion de a -— output int n : dimensions de la matrice caree -— input

ne utilise pas

test

Parameters
inv_anv_a

Definition at line 216 of file inversion.c.

219 {
220  int n = MATRIX_NB_LINES(a);
221  Pmatrix p = matrix_new(n,n);
222  Pmatrix q = matrix_new(n,n);
223  Pmatrix h = matrix_new(n,n);
224  Pmatrix inv_h = matrix_new(n,n);
225  Pmatrix temp = matrix_new(n,n);
226  Value deno;
227  Value det_p, det_q; /* ne utilise pas */
228 
229  /* test */
231 
232  deno = MATRIX_DENOMINATOR(a);
234  matrix_hermite(a,p,h,q,&det_p,&det_q);
235  MATRIX_DENOMINATOR(a) = deno;
236  if ( matrix_hermite_rank(h) == n){
237  MATRIX_DENOMINATOR(h) = deno;
238  matrix_triangular_inversion(h,inv_h,true);
239  matrix_multiply(q,inv_h,temp);
240  matrix_multiply(temp,p,inv_a);
241  }
242  else{
243  fprintf(stderr," L'inverse de la matrice a n'existe pas!\n");
244  exit(1);
245  }
246 }
void matrix_hermite(Pmatrix MAT, Pmatrix P, Pmatrix H, Pmatrix Q, Value *det_p, Value *det_q)
package matrix
Definition: hermite.c:78
void matrix_triangular_inversion(Pmatrix h, Pmatrix inv_h, bool infer)
void matrix_triangular_inversion(Pmatrix h, Pmatrix inv_h,bool infer) calcul de l'inversion du matric...
Definition: inversion.c:137
#define exit(code)
Definition: misc-local.h:54

References assert, exit, fprintf(), MATRIX_DENOMINATOR, matrix_hermite(), matrix_hermite_rank(), matrix_multiply(), MATRIX_NB_LINES, matrix_new(), matrix_triangular_inversion(), VALUE_ONE, and value_pos_p.

Referenced by build_contraction_matrices(), and prepare_reindexing().

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

◆ matrix_hermite()

void matrix_hermite ( Pmatrix  MAT,
Pmatrix  P,
Pmatrix  H,
Pmatrix  Q,
Value det_p,
Value det_q 
)

hermite.c

hermite.c

void matrix_hermite(matrix MAT, matrix P, matrix H, matrix Q, int *det_p, int *det_q): calcul de la forme reduite de Hermite H de la matrice MAT avec les deux matrices de changement de base unimodulaire P et Q, telles que H = P x MAT x Q et en le meme temp, produit les determinants des P et Q. det_p = |P|, det_q = |Q|.

(c.f. Programmation Lineaire. Theorie et algorithmes. tome 2. M.MINOUX. Dunod (1983)) FI: Quels est l'invariant de l'algorithme? MAT = P x H x Q? FI: Quelle est la norme decroissante? La condition d'arret?

Les parametres de la fonction :

int MAT[n,m]: matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice int P[n,n] : matrice int H[n,m] : matrice reduite de Hermite int Q[m,m] : matrice int *det_p : determinant de P (nombre de permutation de ligne) int *det_q : determinant de Q (nombre de permutation de colonne)

Les 3 matrices P(nxn), Q(mxm) et H(nxm) doivent etre allouees avant le calcul.

Note: les denominateurs de MAT, P, A et H ne sont pas utilises.

Auteurs: Corinne Ancourt, Yi-qing Yang

Modifications:

  • modification du profil de la fonction pour permettre le calcul du determinant de MAT
  • permutation de colonnes directe, remplacant une permutation par produit de matrices
  • suppression des copies entre H, P, Q et NH, PN, QN

indice de la ligne et indice de la colonne correspondant au plus petit element de la sous-matrice traitee

niveau de la sous-matrice traitee

le plus petit element sur la diagonale

la quotient de la division par ALL

if ((n>0) && (m>0) && MAT)

Initialisation des matrices

tant qu'il reste des termes non nuls dans la partie triangulaire superieure de la matrice H,
on cherche le plus petit element de la sous-matrice

la sous-matrice restante est nulle, on a terminee

s'il existe un plus petit element non nul dans la partie triangulaire superieure de la sous-matrice, on amene cet element en haut sur la diagonale. si cet element est deja sur la diagonale, et que tous les termes de la ligne correspondante sont nuls, on effectue les calculs sur la sous-matrice de rang superieur

Parameters
MATAT
det_pet_p
det_qet_q

Definition at line 78 of file hermite.c.

85 {
86  Pmatrix PN=NULL;
87  Pmatrix QN=NULL;
88  Pmatrix HN = NULL;
89  int n,m;
90  /* indice de la ligne et indice de la colonne correspondant
91  au plus petit element de la sous-matrice traitee */
92  int ind_n,ind_m;
93 
94  /* niveau de la sous-matrice traitee */
95  int level = 0;
96 
97  Value ALL;/* le plus petit element sur la diagonale */
98  Value x=VALUE_ZERO; /* la quotient de la division par ALL */
99  bool stop = false;
100  int i;
101 
102  *det_p = *det_q = VALUE_ONE;
103  /* if ((n>0) && (m>0) && MAT) */
104  n = MATRIX_NB_LINES(MAT);
105  m=MATRIX_NB_COLUMNS(MAT);
106  assert(n >0 && m > 0);
108 
109  HN = matrix_new(n, m);
110  PN = matrix_new(n, n);
111  QN = matrix_new(m, m);
112 
113  /* Initialisation des matrices */
114 
115  matrix_assign(MAT,H);
116  matrix_identity(PN,0);
117  matrix_identity(QN,0);
118  matrix_identity(P,0);
119  matrix_identity(Q,0);
120  matrix_nulle(HN);
121 
122  while (!stop) {
123  /* tant qu'il reste des termes non nuls dans la partie
124  triangulaire superieure de la matrice H,
125  on cherche le plus petit element de la sous-matrice */
126  matrix_coeff_nnul(H,&ind_n,&ind_m,level);
127 
128  if (ind_n == 0 && ind_m == 0)
129  /* la sous-matrice restante est nulle, on a terminee */
130  stop = true;
131  else {
132  /* s'il existe un plus petit element non nul dans la partie
133  triangulaire superieure de la sous-matrice,
134  on amene cet element en haut sur la diagonale.
135  si cet element est deja sur la diagonale, et que tous les
136  termes de la ligne correspondante sont nuls,
137  on effectue les calculs sur la sous-matrice de rang superieur*/
138 
139  if (ind_n > level + 1) {
140  matrix_swap_rows(H,level+1,ind_n);
141  matrix_swap_rows(PN,level+1,ind_n);
142  *det_p = value_uminus(*det_p);
143  }
144 
145  if (ind_m > level+1) {
146  matrix_swap_columns(H,level+1,ind_m);
147  matrix_swap_columns(QN,level+1,ind_m);
148  *det_q = value_uminus(*det_q);
149  }
150 
151  if(matrix_line_el(H,level) != 0) {
152  ALL = SUB_MATRIX_ELEM(H,1,1,level);
153  for (i=level+2; i<=m; i++) {
154  x = value_div(MATRIX_ELEM(H,level+1,i),ALL);
157  }
158 
159  }
160  else level++;
161  }
162  }
163 
164  matrix_assign(PN,P);
165  matrix_assign(QN,Q);
166  matrix_free(HN);
167  matrix_free(PN);
168  matrix_free(QN);
169 }
#define value_uminus(val)
unary operators on values
#define value_one_p(val)
#define SUB_MATRIX_ELEM(matrix, i, j, level)
MATRIX_RIGHT_INF_ELEM Permet d'acceder des sous-matrices dont le coin infe'rieur droit (i....
Definition: matrix-local.h:106
#define matrix_free(m)
Allocation et desallocation d'une matrice.
Definition: matrix-local.h:73
void matrix_swap_rows(Pmatrix A, int r1, int r2)
void matrix_swap_rows(Pmatrix a, int r1, int r2): exchange rows r1 and r2 of an (nxm) rational matrix...
Definition: matrix.c:230
void matrix_swap_columns(Pmatrix A, int c1, int c2)
void matrix_swap_columns(Pmatrix a, int c1, int c2): exchange columns c1,c2 of an (nxm) rational matr...
Definition: matrix.c:209
void matrix_subtraction_column(Pmatrix MAT, int c1, int c2, Value x)
void matrix_subtraction_column(Pmatrix MAT,int c1,int c2,int x): Soustrait x fois la colonne c2 de la...
Definition: matrix.c:518
void matrix_assign(Pmatrix A, Pmatrix B)
void matrix_assign(Pmatrix A, Pmatrix B) Copie de la matrice A dans la matrice B
Definition: matrix.c:259
void matrix_coeff_nnul(Pmatrix, int *, int *, int)
void matrix_coeff_nnul(Pmatrix MAT, int * lg_nnul, int * cl_nnul, int level) renvoie les coordonnees ...
Definition: sub-matrix.c:421
int matrix_line_el(Pmatrix, int)
int matrix_line_el(Pmatrix MAT, int level) renvoie le numero de colonne absolu du premier element non...
Definition: sub-matrix.c:379
void matrix_identity(Pmatrix, int)
void matrix_identity(Pmatrix ID, int level) Construction d'une sous-matrice identity dans ID(level+1....
Definition: sub-matrix.c:322
#define ALL
Definition: readmakefile.c:178
static char * x
Definition: split_file.c:159

References ALL, assert, level, matrix_assign(), matrix_coeff_nnul(), MATRIX_DENOMINATOR, MATRIX_ELEM, matrix_free, matrix_identity(), matrix_line_el(), MATRIX_NB_COLUMNS, MATRIX_NB_LINES, matrix_new(), matrix_nulle(), matrix_subtraction_column(), matrix_swap_columns(), matrix_swap_rows(), Q, SUB_MATRIX_ELEM, value_div, VALUE_ONE, value_one_p, value_uminus, VALUE_ZERO, and x.

Referenced by extract_lattice(), matrix_determinant(), matrix_general_inversion(), matrix_unimodular_inversion(), prepare_reindexing(), and region_sc_minimal().

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

◆ matrix_hermite_rank()

int matrix_hermite_rank ( Pmatrix  a)

int matrix_hermite_rank(Pmatrix a): rang d'une matrice en forme de hermite

Definition at line 174 of file hermite.c.

176 {
177  int i;
178  int r = 0;
179  int n = MATRIX_NB_LINES(a);
180  for(i=1; i<=n; i++, r++)
181  if(MATRIX_ELEM(a, i, i) == 0) break;
182 
183  return r;
184 }

References MATRIX_ELEM, and MATRIX_NB_LINES.

Referenced by matrix_diagonal_inversion(), matrix_general_inversion(), and matrix_triangular_inversion().

+ Here is the caller graph for this function:

◆ matrix_identity()

void matrix_identity ( Pmatrix  ID,
int  level 
)

void matrix_identity(Pmatrix ID, int level) Construction d'une sous-matrice identity dans ID(level+1..n, level+1..n)

Les parametres de la fonction :

!int ID[] : matrice int n : nombre de lignes de la matrice int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice

Parameters
IDD
levelevel

Definition at line 322 of file sub-matrix.c.

325 {
326  int i,j;
327  int n = MATRIX_NB_LINES(ID);
328  for(i = level+1; i <= n; i++) {
329  for(j = level+1; j <= n; j++)
330  MATRIX_ELEM(ID,i,j) = VALUE_ZERO;
331  MATRIX_ELEM(ID,i,i) = VALUE_ONE;
332  }
333 
335 }

References level, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_LINES, VALUE_ONE, and VALUE_ZERO.

Referenced by build_contraction_matrices(), extract_lattice(), matrix_hermite(), matrix_maj_col(), matrix_maj_line(), matrix_smith(), matrix_unimodular_triangular_inversion(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_identity_p()

bool matrix_identity_p ( Pmatrix  ID,
int  level 
)

bool matrix_identity_p(Pmatrix ID, int level) test d'une sous-matrice dans ID(level+1..n, level+1..n) pour savoir si c'est une matrice identity.

Le test n'est correct que si la matrice ID passee en argument est normalisee (cf. matrix_normalize())

Pour tester toute la matrice ID, appeler avec level==0

Les parametres de la fonction :

int ID[] : matrice int n : nombre de lignes (et de colonnes) de la matrice ID int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice

i!=j

Parameters
IDD
levelevel

Definition at line 352 of file sub-matrix.c.

355 {
356  int i,j;
357  int n = MATRIX_NB_LINES(ID);
358  for(i = level+1; i <= n; i++) {
359  for(j = level+1; j <= n; j++) {
360  if(i==j) {
361  if(value_notone_p(MATRIX_ELEM(ID,i,i)))
362  return(false);
363  }
364  else /* i!=j */
365  if(value_notzero_p(MATRIX_ELEM(ID,i,j)))
366  return(false);
367  }
368  }
369  return(true);
370 }
#define value_notone_p(val)

References level, MATRIX_ELEM, MATRIX_NB_LINES, value_notone_p, and value_notzero_p.

◆ matrix_line_el()

int matrix_line_el ( Pmatrix  MAT,
int  level 
)

int matrix_line_el(Pmatrix MAT, int level) renvoie le numero de colonne absolu du premier element non nul de la sous-ligne MAT(level+1,level+2..m); renvoie 0 si la sous-ligne est vide.

RGUSED

recherche du premier element non nul de la sous-ligne MAT(level+1,level+2..m)

Parameters
MATAT
levelevel

Definition at line 379 of file sub-matrix.c.

382 {
383  int j;
384  int j_min = 0;
385  int m = MATRIX_NB_COLUMNS(MAT);
386  /* recherche du premier element non nul de la sous-ligne
387  MAT(level+1,level+2..m) */
388  for(j = level+2; j<=m && (MATRIX_ELEM(MAT,1+level,j)==0) ; j++);
389  if(j < m+1)
390  j_min = j-1;
391  return (j_min);
392 }

References level, MATRIX_ELEM, and MATRIX_NB_COLUMNS.

Referenced by matrix_hermite(), matrix_smith(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_line_nnul()

int matrix_line_nnul ( Pmatrix  MAT,
int  level 
)

sub-matrix.c

sub-matrix.c

resultat retourne par la fonction :

int : numero de la premiere ligne non nulle de la matrice MAT; ou 0 si la sous-matrice MAT(level+1 ..n,level+1 ..m) est identiquement nulle;

parametres de la fonction :

int MAT[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice

recherche du premier element non nul de la sous-matrice

on dumpe la colonne J...

Parameters
MATAT
levelevel

Definition at line 72 of file sub-matrix.c.

75 {
76  int i,j;
77  int I = 0;
78  bool trouve = false;
79  int n = MATRIX_NB_LINES(MAT);
80  int m= MATRIX_NB_COLUMNS(MAT);
81  /* recherche du premier element non nul de la sous-matrice */
82  for (i = level+1; i<=n && !trouve ; i++) {
83  for (j = level+1; j<= m && (MATRIX_ELEM(MAT,i,j) == 0); j++);
84  if(j <= m) {
85  /* on dumpe la colonne J... */
86  trouve = true;
87  I = i;
88  }
89  }
90  return (I);
91 }

References level, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by matrix_coeff_nnul().

+ Here is the caller graph for this function:

◆ matrix_maj_col()

void matrix_maj_col ( Pmatrix  A,
Pmatrix  P,
int  level 
)

void matrix_maj_col(Pmatrix A, matrice P, int level): Calcul de la matrice permettant de remplacer chaque terme de la premiere ligne de la sous-matrice A(level+1 ..n, level+1 ..m) autre que le premier terme A11=A(level+1,level+1) par le reste de sa division entiere par A11

La matrice P est modifiee.

Les parametres de la fonction :

int A[1..n,1..m] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice (unused) !int P[] : matrice de dimension au moins P[1..n, 1..n] int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice RGSUSED

Parameters
levelevel

Definition at line 256 of file sub-matrix.c.

260 {
261  Value A11;
262  int i;
263  Value x;
264  int n = MATRIX_NB_LINES(A);
265  matrix_identity(P,0);
266 
267  A11 =SUB_MATRIX_ELEM(A,1,1,level);
268  for (i=2+level; i<=n; i++) {
269  x = MATRIX_ELEM(A,i,1+level);
270  value_division(x,A11);
271  MATRIX_ELEM(P,i,1+level) = value_uminus(x);
272  }
273 }
#define value_division(ref, val)
void matrix_identity(Pmatrix ID, int level)
void matrix_identity(Pmatrix ID, int level) Construction d'une sous-matrice identity dans ID(level+1....
Definition: sub-matrix.c:322

References level, MATRIX_ELEM, matrix_identity(), MATRIX_NB_LINES, SUB_MATRIX_ELEM, value_division, value_uminus, and x.

Referenced by smith_int().

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

◆ matrix_maj_line()

void matrix_maj_line ( Pmatrix  A,
Pmatrix  Q,
int  level 
)

void matrix_maj_line(Pmatrix A, matrice Q, int level): Calcul de la matrice permettant de remplacer chaque terme de la premiere ligne autre que le premier terme A11=A(level+1,level+1) par le reste de sa division entiere par A11

La matrice Q est modifiee.

Les parametres de la fonction :

int A[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice !int Q[] : matrice int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice

Parameters
levelevel

Definition at line 294 of file sub-matrix.c.

298 {
299  Value A11;
300  int j;
301  Value x;
302  int m= MATRIX_NB_COLUMNS(A);
303  matrix_identity(Q,0);
304  A11 =SUB_MATRIX_ELEM(A,1,1,level);
305  for (j=2+level; j<=m; j++) {
306  x = value_div(MATRIX_ELEM(A,1+level,j),A11);
307  MATRIX_ELEM(Q,1+level,j) = value_uminus(x);
308  }
309 }

References level, MATRIX_ELEM, matrix_identity(), MATRIX_NB_COLUMNS, Q, SUB_MATRIX_ELEM, value_div, value_uminus, and x.

Referenced by smith_int().

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

◆ matrix_min()

void matrix_min ( Pmatrix  MAT,
int i_min,
int j_min,
int  level 
)

void matrix_min(Pmatrix MAT, int * i_min, int * j_min, int level): Recherche des coordonnees (*i_min, *j_min) de l'element de la sous-matrice MAT(level+1 ..n, level+1 ..m) dont la valeur absolue est la plus petite et non nulle.

QQ i dans [level+1 ..n] QQ j dans [level+1 ..m] | MAT[*i_min, *j_min] | <= | MAT[i, j]

resultat retourne par la fonction :

les parametres i_min et j_min sont modifies.

parametres de la fonction :

int MAT[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice !int i_min : numero de la ligne a laquelle se trouve le plus petit element !int j_min : numero de la colonne a laquelle se trouve le plus petit int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice element

initialisation du minimum car recherche d'un minimum non nul

Parameters
MATAT
i_min_min
j_min_min
levelevel

Definition at line 196 of file sub-matrix.c.

200 {
201  int i,j;
202  int vali= 0;
203  int valj=0;
205  Value val=VALUE_ZERO;
206  bool trouve = false;
207 
208  int n = MATRIX_NB_LINES(MAT);
209  int m= MATRIX_NB_COLUMNS(MAT);
210  /* initialisation du minimum car recherche d'un minimum non nul*/
211  for (i=1+level;i<=n && !trouve;i++)
212  for(j = level+1; j <= m && !trouve; j++) {
213  min = MATRIX_ELEM(MAT,i,j);
214  min = value_abs(min);
215  if(value_notzero_p(min)) {
216  trouve = true;
217  vali = i;
218  valj = j;
219  }
220  }
221 
222  for (i=1+level;i<=n;i++)
223  for (j=1+level;j<=m && value_gt(min,VALUE_ONE); j++) {
224  val = MATRIX_ELEM(MAT,i,j);
225  val = value_abs(val);
226  if (value_notzero_p(val) && value_lt(val,min)) {
227  min = val;
228  vali= i;
229  valj =j;
230  }
231  }
232  *i_min = vali;
233  *j_min = valj;
234 }

References level, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, min, value_abs, value_gt, value_lt, value_notzero_p, VALUE_ONE, and VALUE_ZERO.

Referenced by matrix_smith(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_multiply()

void matrix_multiply ( const Pmatrix  a,
const Pmatrix  b,
Pmatrix  c 
)

void matrix_multiply(Pmatrix a, Pmatrix b, Pmatrix c): multiply rational matrix a by rational matrix b and store result in matrix c

 a is a (pxq) matrix, b a (qxr) and c a (pxr)

 c := a x b ;

Algorithm used is directly from definition, and space has to be provided for output matrix c by caller. Matrix c is not necessarily normalized: its denominator may divide all its elements (see matrix_normalize()).

Precondition: p > 0; q > 0; r > 0; c != a; c != b; – aliasing between c and a or b – is not supported

validate dimensions

simplified aliasing test

set denominator

use ordinary school book algorithm

Definition at line 95 of file matrix.c.

96 {
97  /* validate dimensions */
98  int p = MATRIX_NB_LINES(a);
99  int q = MATRIX_NB_COLUMNS(a);
100  int r = MATRIX_NB_COLUMNS(b);
101  // should check that all dimensions are compatible & well allocated?!
102 
103  assert(p > 0 && q > 0 && r > 0);
104  /* simplified aliasing test */
105  assert(c != a && c != b);
106 
107  /* set denominator */
108  MATRIX_DENOMINATOR(c) =
110 
111  /* use ordinary school book algorithm */
112  int i, j, k;
113  for(i=1; i<=p; i++) {
114  for(j=1; j<=r; j++) {
115  Value v = VALUE_ZERO;
116  for(k=1; k<=q; k++) {
117  Value va = MATRIX_ELEM(a, i, k);
118  Value vb = MATRIX_ELEM(b, k, j);
119  value_addto(v, value_mult(va, vb));
120  }
121  MATRIX_ELEM(c, i, j) = v;
122  }
123  }
124 }
#define value_addto(ref, val)

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, value_addto, value_mult, and VALUE_ZERO.

Referenced by extract_lattice(), fusion_buffer(), make_reindex(), matrices_to_1D_lattice(), matrix_general_inversion(), matrix_unimodular_inversion(), prepare_reindexing(), region_sc_minimal(), sc_resol_smith(), smith_int(), and Tiling_buffer_allocation().

+ Here is the caller graph for this function:

◆ matrix_new()

◆ matrix_normalize()

void matrix_normalize ( Pmatrix  a)

void matrix_normalize(Pmatrix a)

 A rational matrix is stored as an integer one with one extra
 integer, the denominator for all the elements. To normalise the
 matrix in this sense means to reduce this denominator to the
 smallest positive number possible. All elements are also reduced
 to their smallest possible value.

Precondition: MATRIX_DENOMINATOR(a)!=0

we must find the GCD of all elements of matrix

factor out

ensure denominator is positive

FI: this code is useless because pgcd()always return a positive integer, even if a is the null matrix; its denominator CANNOT be 0

Definition at line 136 of file matrix.c.

137 {
138  int m = MATRIX_NB_LINES(a);
139  int n = MATRIX_NB_COLUMNS(a);
140  assert(MATRIX_DENOMINATOR(a) != 0);
141 
142  /* we must find the GCD of all elements of matrix */
143  Value factor = MATRIX_DENOMINATOR(a);
144 
145  int i, j;
146  for(i=1; i<=m; i++)
147  for(j=1; j<=n; j++)
148  factor = pgcd(factor, MATRIX_ELEM(a,i,j));
149 
150  /* factor out */
151  if (value_notone_p(factor)) {
152  for(i=1; i<=m; i++)
153  for(j=1; j<=n; j++)
154  value_division(MATRIX_ELEM(a,i,j), factor);
156  }
157 
158  /* ensure denominator is positive */
159  /* FI: this code is useless because pgcd()always return a positive integer,
160  even if a is the null matrix; its denominator CANNOT be 0 */
162 
163 /*
164  if(MATRIX_DENOMINATOR(a) < 0) {
165  MATRIX_DENOMINATOR(a) = MATRIX_DENOMINATOR(a)*-1;
166  for(loop1=1; loop1<=n; loop1++)
167  for(loop2=1; loop2<=m; loop2++)
168  MATRIX_ELEM(a,loop1,loop2) =
169  -1 * MATRIX_ELEM(a,loop1,loop2);
170  }*/
171 }

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, pgcd, value_division, value_notone_p, and value_pos_p.

Referenced by make_reindex(), and prepare_reindexing().

+ Here is the caller graph for this function:

◆ matrix_normalizec()

void matrix_normalizec ( Pmatrix  MAT)

void matrix_normalizec(Pmatrix MAT): Normalisation des coefficients de la matrice MAT, i.e.

division des coefficients de la matrice MAT et de son denominateur par leur pgcd

La matrice est modifiee.

Les parametres de la fonction :

!int MAT[] : matrice de dimension (n,m) int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

??? matrix is supposed to be positive?

Parameters
MATAT

Definition at line 187 of file matrix.c.

188 {
189  int m = MATRIX_NB_LINES(MAT);
190  int n = MATRIX_NB_COLUMNS(MAT);
191  assert( n>0 && m>0);
192 
193  Value a = MATRIX_DENOMINATOR(MAT);
194  int i;
195  for (i = 0; i<m*n && value_gt(a, VALUE_ONE); i++)
196  a = pgcd(a, MAT->coefficients[i]);
197 
198  if (value_gt(a,VALUE_ONE)) {
199  for (i = 0; i<m*n; i++)
200  value_division(MAT->coefficients[i],a);
201  }
202 }

References assert, Pmatrix::coefficients, MATRIX_DENOMINATOR, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, pgcd, value_division, value_gt, and VALUE_ONE.

Referenced by sc_resol_smith(), and smith_int().

+ Here is the caller graph for this function:

◆ matrix_nulle()

void matrix_nulle ( Pmatrix  Z)

void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle

Post-condition:

QQ i dans [1..n] QQ j dans [1..n] Z(i,j) == 0

Definition at line 293 of file matrix.c.

294 {
295  int m = MATRIX_NB_LINES(Z);
296  int n = MATRIX_NB_COLUMNS(Z);
297  int i,j;
298  for (i=1; i<=m; i++)
299  for (j=1; j<=n; j++)
300  MATRIX_ELEM(Z,i,j) = VALUE_ZERO;
302 }

References MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, VALUE_ONE, and VALUE_ZERO.

Referenced by build_contraction_matrices(), compute_delay_merged_nest(), compute_delay_tiled_nest(), constraints_to_matrices(), constraints_with_sym_cst_to_matrices(), egalites_to_matrice(), matrix_diagonal_inversion(), matrix_hermite(), matrix_perm_col(), matrix_perm_line(), matrix_triangular_inversion(), my_constraints_with_sym_cst_to_matrices(), sc_resol_smith(), smith_int(), and sys_mat_conv().

+ Here is the caller graph for this function:

◆ matrix_nulle_p()

bool matrix_nulle_p ( Pmatrix  Z)

bool matrix_nulle_p(Pmatrix Z): test de nullite de la matrice Z

QQ i dans [1..n] QQ j dans [1..n] Z(i,j) == 0

Definition at line 311 of file matrix.c.

312 {
313  int m = MATRIX_NB_LINES(Z);
314  int n = MATRIX_NB_COLUMNS(Z);
315  int i, j;
316  for (i=1; i<=m; i++)
317  for (j=1; j<=n; j++)
318  if (MATRIX_ELEM(Z,i,j) != VALUE_ZERO)
319  return false;
320  return true;
321 }

References MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, and VALUE_ZERO.

◆ matrix_perm_col()

void matrix_perm_col ( Pmatrix  MAT,
int  k,
int  level 
)

void matrix_perm_col(Pmatrix MAT, int k, int level): Calcul de la matrice de permutation permettant d'amener la k-ieme ligne de la matrice MAT(1..n,1..m) a la ligne (level + 1).

Si l'on veut amener la k-ieme ligne de la matrice en premiere ligne 'level' doit avoir la valeur 0

parametres de la fonction :

!int MAT[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice (unused) int k : numero de la ligne a remonter a la premiere ligne int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice

Note: pour eviter une multiplication de matrice en O(n**3), il vaudrait mieux programmer directement la permutation en O(n**2) sans multiplications Il est inutile de faire souffrir notre chip SPARC! (FI) RGSUSED

Parameters
MATAT
levelevel

Definition at line 115 of file sub-matrix.c.

118 {
119  int i,j;
120  int n = MATRIX_NB_LINES(MAT);
121  matrix_nulle(MAT);
122  if (level > 0) {
123  for (i=1;i<=level; i++)
124  MATRIX_ELEM(MAT,i,i) = VALUE_ONE;
125  }
126 
127  for (i=1+level,j=k; i<=n; i++,j++)
128  {
129  if (j == n+1) j = 1 + level;
130  MATRIX_ELEM(MAT,i,j)=VALUE_ONE;
131  }
132 }

References level, MATRIX_ELEM, MATRIX_NB_LINES, matrix_nulle(), and VALUE_ONE.

Referenced by smith_int().

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

◆ matrix_perm_line()

void matrix_perm_line ( Pmatrix  MAT,
int  k,
int  level 
)

void matrix_perm_line(Pmatrix MAT, int k, int level): Calcul de la matrice de permutation permettant d'amener la k-ieme colonne de la sous-matrice MAT(1..n,1..m) a la colonne 'level + 1' (premiere colonne de la sous matrice MAT(level+1 ..n,level+1 ..m)).

parametres de la fonction :

!int MAT[] : matrice int n : nombre de lignes de la matrice (unused) int m : nombre de colonnes de la matrice int k : numero de la colonne a placer a la premiere colonne int level : niveau de la matrice i.e. numero de la premiere ligne et de la premiere colonne a partir duquel on commence a prendre en compte les elements de la matrice RGSUSED

Parameters
MATAT
levelevel

Definition at line 150 of file sub-matrix.c.

153 {
154  int i,j;
155  int m= MATRIX_NB_COLUMNS(MAT);
156  matrix_nulle(MAT);
157  if(level > 0) {
158  for (i = 1; i <= level;i++)
159  MATRIX_ELEM(MAT,i,i) = VALUE_ONE;
160  }
161 
162  for(j=1,i=k-level; j <= m - level; j++,i++) {
163  if(i == m-level+1)
164  i = 1;
165  SUB_MATRIX_ELEM(MAT,i,j,level) = VALUE_ONE;
166  }
167 }

References level, MATRIX_ELEM, MATRIX_NB_COLUMNS, matrix_nulle(), SUB_MATRIX_ELEM, and VALUE_ONE.

Referenced by smith_int().

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

◆ matrix_pr_quot()

void matrix_pr_quot ( FILE *  ,
Value  ,
Value   
)

◆ matrix_print()

void matrix_print ( Pmatrix  a)

void matrix_print(matrice a): print an (nxm) rational matrix

Note: the output format is incompatible with matrix_fscan() this should be implemented as a macro, but it's a function for dbx's sake

Definition at line 70 of file matrix_io.c.

72 {
73  matrix_fprint(stdout,a);
74 }
void matrix_fprint(FILE *f, Pmatrix a)
package matrice
Definition: matrix_io.c:44

References matrix_fprint().

Referenced by Hierarchical_tiling(), matrix_smith(), sc_resol_smith(), smith_int(), and Tiling2_buffer().

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

◆ matrix_rm()

void matrix_rm ( Pmatrix  a)

Definition at line 52 of file alloc.c.

53 {
54  if (a) {
55  free(a->coefficients);
56  free(a);
57  }
58 }

References Pmatrix::coefficients, and free().

+ Here is the call graph for this function:

◆ matrix_smith()

void matrix_smith ( Pmatrix  MAT,
Pmatrix  P,
Pmatrix  D,
Pmatrix  Q 
)

smith.c

smith.c

D est la forme reduite de Smith, P et Q sont des matrices unimodulaires; telles que D == P x MAT x Q

(c.f. Programmation Lineaire. M.MINOUX. (83))

int MAT[n,m] : matrice int n : nombre de lignes de la matrice MAT int m : nombre de colonnes de la matrice MAT int P[n,n] : matrice int D[n,m] : matrice (quasi-diagonale) reduite de Smith int Q[m,m] : matrice

Les 3 matrices P(nxn), Q(mxm) et D(nxm) doivent etre allouees avant le calcul.

Note: les determinants des matrices MAT, P, Q et D ne sont pas utilises.

le plus petit element sur la diagonale

le rest de la division par ALL

precondition sur les parametres

le transformation n'est pas fini.

Parameters
MATAT

Definition at line 68 of file smith.c.

73 {
74  int n_min,m_min;
75  int level = 0;
76  Value ALL; /* le plus petit element sur la diagonale */
77  Value x=VALUE_ZERO; /* le rest de la division par ALL */
78  int i;
79 
80  bool stop = false;
81  bool next = true;
82 
83  /* precondition sur les parametres */
84  int n = MATRIX_NB_LINES(MAT);
85  int m = MATRIX_NB_COLUMNS(MAT);
86  assert(m > 0 && n >0);
87  matrix_assign(MAT,D);
89 
90  matrix_identity(P,0);
91  matrix_identity(Q,0);
92 
93  while (!stop) {
94  matrix_min(D,&n_min,&m_min,level);
95 
96  if ((n_min == 0) && (m_min == 0))
97  stop = true;
98  else {
99  /* le transformation n'est pas fini. */
100  if (n_min > level +1) {
101  matrix_swap_rows(D,level+1,n_min);
102  matrix_swap_rows(P,level+1,n_min);
103  }
104 #ifdef TRACE
105  (void) printf (" apres alignement du plus petit element a la premiere ligne \n");
106  matrix_print(D);
107 #endif
108  if (m_min >1+level) {
109  matrix_swap_columns(D,level+1,m_min);
110  matrix_swap_columns(Q,level+1,m_min);
111  }
112 #ifdef TRACE
113  (void) printf (" apres alignement du plus petit element a la premiere colonne\n");
114  matrix_print(D);
115 #endif
116 
117  ALL = SUB_MATRIX_ELEM(D,1,1,level);
118  if (matrix_line_el(D,level) != 0)
119  for (i=level+2; i<=m; i++) {
120  x = value_div(MATRIX_ELEM(D,level+1,i),ALL);
123  next = false;
124  }
125  if (matrix_col_el(D,level) != 0)
126  for(i=level+2;i<=n;i++) {
127  x = value_div(MATRIX_ELEM(D,i,level+1),ALL);
130  next = false;
131  }
132 #ifdef TRACE
133  (void) printf("apres division par A(%d,%d) des termes de la %d-ieme ligne et de la %d-em colonne \n",level+1,level+1,level+1,level+1);
134  matrix_print(D);
135 #endif
136  if (next) level++;
137  next = true;
138  }
139  }
140 
141 #ifdef TRACE
142  (void) printf (" la matrice D apres transformation est la suivante :");
143  matrix_print(D);
144 
145  (void) printf (" la matrice P est \n");
146  matrix_print(P);
147 
148  (void) printf (" la matrice Q est \n");
149  matrix_print(Q);
150 #endif
151 }
void matrix_subtraction_line(Pmatrix MAT, int r1, int r2, Value x)
void matrix_subtraction_line(Pmatrix MAT,int r1,int r2,int x): Soustrait x fois la ligne r2 de la lig...
Definition: matrix.c:541
void matrix_print(Pmatrix)
void matrix_print(matrice a): print an (nxm) rational matrix
Definition: matrix_io.c:70
int matrix_col_el(Pmatrix, int)
int matrix_col_el(Pmatrix MAT, int level) renvoie le numero de ligne absolu du premier element non nu...
Definition: sub-matrix.c:401
void matrix_min(Pmatrix, int *, int *, int)
void matrix_min(Pmatrix MAT, int * i_min, int * j_min, int level): Recherche des coordonnees (*i_min,...
Definition: sub-matrix.c:196
int printf()

References ALL, assert, D, level, matrix_assign(), matrix_col_el(), MATRIX_DENOMINATOR, MATRIX_ELEM, matrix_identity(), matrix_line_el(), matrix_min(), MATRIX_NB_COLUMNS, MATRIX_NB_LINES, matrix_print(), matrix_subtraction_column(), matrix_subtraction_line(), matrix_swap_columns(), matrix_swap_rows(), printf(), Q, SUB_MATRIX_ELEM, value_div, value_one_p, VALUE_ZERO, and x.

Referenced by main(), matrices_to_1D_lattice(), and sc_resol_smith().

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

◆ matrix_sub_determinant()

void matrix_sub_determinant ( Pmatrix  ,
int  ,
int  ,
Value  [] 
)

◆ matrix_substract()

void matrix_substract ( Pmatrix  a,
Pmatrix  b,
Pmatrix  c 
)

void matrix_substract(Pmatrix a, Pmatrix b, Pmatrix c): substract rational matrix c from rational matrix b and store result in matrix a

 a is a (nxm) matrix, b a (nxm) and c a (nxm)

 a = b - c ;

Algorithm used is directly from definition, and space has to be provided for output matrix a by caller. Matrix a is not necessarily normalized: its denominator may divide all its elements (see matrix_normalize()).

Precondition: n > 0; m > 0; Note: aliasing between a and b or c is supported

denominators of b, c

ppcm of b,c

precondition

Definition at line 435 of file matrix.c.

436 {
437  Value d1,d2; /* denominators of b, c */
438  Value lcm; /* ppcm of b,c */
439  int i,j;
440 
441  /* precondition */
442  int m = MATRIX_NB_LINES(a);
443  int n = MATRIX_NB_COLUMNS(a);
444  assert(n>0 && m>0);
447 
448  d1 = MATRIX_DENOMINATOR(b);
449  d2 = MATRIX_DENOMINATOR(c);
450  if (value_eq(d1,d2)){
451  for (i=1; i<=m; i++)
452  for (j=1; j<=n; j++)
453  MATRIX_ELEM(a,i,j) =
454  value_minus(MATRIX_ELEM(b,i,j),MATRIX_ELEM(c,i,j));
455  MATRIX_DENOMINATOR(a) = d1;
456  }
457  else {
458  lcm = ppcm(d1,d2);
459  d1 = value_div(lcm,d1);
460  d2 = value_div(lcm,d2);
461  for (i=1; i<=m; i++)
462  for (j=1; j<=n; j++)
463  MATRIX_ELEM(a,i,j) =
465  value_mult(MATRIX_ELEM(c,i,j),d2));
466  MATRIX_DENOMINATOR(a) = lcm;
467  }
468 }
#define value_minus(v1, v2)

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, ppcm(), value_div, value_eq, value_minus, value_mult, and value_pos_p.

Referenced by compute_delay_merged_nest(), compute_delay_tiled_nest(), fusion_buffer(), and Tiling_buffer_allocation().

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

◆ matrix_subtraction_column()

void matrix_subtraction_column ( Pmatrix  MAT,
int  c1,
int  c2,
Value  x 
)

void matrix_subtraction_column(Pmatrix MAT,int c1,int c2,int x): Soustrait x fois la colonne c2 de la colonne c1 Precondition: n > 0; m > 0; 0 < c1, c2 < m; Effet: c1[0..n-1] = c1[0..n-1] - x*c2[0..n-1].

Les parametres de la fonction :

int MAT[] : matrice int c1 : numero du colonne int c2 : numero du colonne int x :

Parameters
MATAT
c11
c22

Definition at line 518 of file matrix.c.

519 {
520  int m = MATRIX_NB_LINES(MAT);
521  int i;
522  for (i=1; i<=m; i++)
523  value_substract(MATRIX_ELEM(MAT,i,c1),
524  value_mult(x, MATRIX_ELEM(MAT,i,c2)));
525 }
#define value_substract(ref, val)

References MATRIX_ELEM, MATRIX_NB_LINES, value_mult, value_substract, and x.

Referenced by matrix_hermite(), matrix_smith(), and matrix_unimodular_triangular_inversion().

+ Here is the caller graph for this function:

◆ matrix_subtraction_line()

void matrix_subtraction_line ( Pmatrix  MAT,
int  r1,
int  r2,
Value  x 
)

void matrix_subtraction_line(Pmatrix MAT,int r1,int r2,int x): Soustrait x fois la ligne r2 de la ligne r1 Precondition: n > 0; m > 0; 0 < r1, r2 < n; Effet: r1[0..m-1] = r1[0..m-1] - x*r2[0..m-1]

Les parametres de la fonction :

int MAT[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice int r1 : numero du ligne int r2 : numero du ligne int x :

Parameters
MATAT
r11
r22

Definition at line 541 of file matrix.c.

542 {
543  int n = MATRIX_NB_COLUMNS(MAT);
544  int i;
545  for (i=1; i<=n; i++)
546  value_substract(MATRIX_ELEM(MAT,r1,i),
547  value_mult(x,MATRIX_ELEM(MAT,r2,i)));
548 }

References MATRIX_ELEM, MATRIX_NB_COLUMNS, value_mult, value_substract, and x.

Referenced by matrix_smith().

+ Here is the caller graph for this function:

◆ matrix_swap_columns()

void matrix_swap_columns ( Pmatrix  A,
int  c1,
int  c2 
)

void matrix_swap_columns(Pmatrix a, int c1, int c2): exchange columns c1,c2 of an (nxm) rational matrix

 Precondition:      n > 0; m > 0; 0 < c1 <= m; 0 < c2 <= m;
Parameters
c11
c22

Definition at line 209 of file matrix.c.

210 {
211  int m = MATRIX_NB_LINES(A);
212  int n = MATRIX_NB_COLUMNS(A);
213  assert(n > 0 && m > 0);
214  assert(0 < c1 && c1 <= n);
215  assert(0 < c2 && c2 <= n);
216 
217  int i;
218  for(i=1; i<=m; i++) {
219  Value temp = MATRIX_ELEM(A,i,c1);
220  MATRIX_ELEM(A,i,c1) = MATRIX_ELEM(A,i,c2);
221  MATRIX_ELEM(A,i,c2) = temp;
222  }
223 }

References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by matrix_hermite(), and matrix_smith().

+ Here is the caller graph for this function:

◆ matrix_swap_rows()

void matrix_swap_rows ( Pmatrix  A,
int  r1,
int  r2 
)

void matrix_swap_rows(Pmatrix a, int r1, int r2): exchange rows r1 and r2 of an (nxm) rational matrix a

Precondition: n > 0; m > 0; 1 <= r1 <= n; 1 <= r2 <= n

Parameters
r11
r22

Definition at line 230 of file matrix.c.

231 {
232  int m = MATRIX_NB_LINES(A);
233  int n = MATRIX_NB_COLUMNS(A);
234  assert(n > 0);
235  assert(m > 0);
236  assert(0 < r1 && r1 <= m);
237  assert(0 < r2 && r2 <= m);
238 
239  int i;
240  for(i=1; i<=n; i++) {
241  Value temp = MATRIX_ELEM(A,r1,i);
242  MATRIX_ELEM(A,r1,i) = MATRIX_ELEM(A,r2,i);
243  MATRIX_ELEM(A,r2,i) = temp;
244  }
245 }

References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by matrix_hermite(), and matrix_smith().

+ Here is the caller graph for this function:

◆ matrix_transpose()

void matrix_transpose ( const Pmatrix  A,
Pmatrix  At 
)

void matrix_transpose(Pmatrix a, Pmatrix a_t): transpose an (nxm) rational matrix a into a (mxn) rational matrix a_t

   t

At := A ;

verification step

copy from a to a_t

Parameters
Att

Definition at line 64 of file matrix.c.

65 {
66  /* verification step */
67  int m = MATRIX_NB_LINES(A);
68  int n = MATRIX_NB_COLUMNS(A);
69  assert(n >= 0 && m >= 0);
70 
71  /* copy from a to a_t */
73  int i, j;
74  for(i=1; i<=m; i++)
75  for(j=1; j<=n; j++)
76  MATRIX_ELEM(At,j,i) = MATRIX_ELEM(A,i,j);
77 }

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by region_sc_minimal().

+ Here is the caller graph for this function:

◆ matrix_triangular_inversion()

void matrix_triangular_inversion ( Pmatrix  h,
Pmatrix  inv_h,
bool  infer 
)

void matrix_triangular_inversion(Pmatrix h, Pmatrix inv_h,bool infer) calcul de l'inversion du matrice en forme triangulaire.

soit h matrice de la reduite triangulaire; inv_h est l'inversion de h ; telle que : h * inv_h = I. selon les proprietes de la matrice triangulaire: Aii = a11* ...aii-1*aii+1...*ann; Aij = 0 i>j pour la matrice triangulaire inferieure (infer==true) i<j pour la matrice triangulaire superieure (infer==false)

les parametres de la fonction : matrice h : matrice en forme triangulaire – input matrice inv_h : l'inversion de h – output int n : dimension de la matrice caree – input bool infer : le type de triangulaire – input

denominateur

determinant

tests des preconditions

calcul du determinant de h

calcul du denominateur de inv_h

calcul des sub_determinants des Aii

calcul des sub_determinants des Aij (i<j)

Parameters
inv_hnv_h
infernfer

Definition at line 137 of file inversion.c.

141 {
142  Value deno,deno1; /* denominateur */
143  Value determinant,sub_determinant; /* determinant */
144  Value gcd;
145  int i,j;
146  Value aij[2];
147 
148  /* tests des preconditions */
149  int n = MATRIX_NB_LINES(h);
150  assert(matrix_triangular_p(h,infer));
153 
154  matrix_nulle(inv_h);
155  deno = MATRIX_DENOMINATOR(h);
156  deno1 = deno;
158  /* calcul du determinant de h */
159  determinant = VALUE_ONE;
160  for (i= 1; i<=n; i++)
161  value_product(determinant, MATRIX_ELEM(h,i,i));
162 
163  /* calcul du denominateur de inv_h */
164  gcd = pgcd(deno1,determinant);
165  if (value_notone_p(gcd)){
166  value_division(deno1,gcd);
167  value_division(determinant,gcd);
168  }
169  if (value_neg_p(determinant)){
170  value_oppose(deno1);
171  value_oppose(determinant);
172  }
173  MATRIX_DENOMINATOR(inv_h) = determinant;
174  /* calcul des sub_determinants des Aii */
175  for (i=1; i<=n; i++){
176  sub_determinant = VALUE_ONE;
177  for (j=1; j<=n; j++)
178  if (j != i)
179  value_product(sub_determinant, MATRIX_ELEM(h,j,j));
180  MATRIX_ELEM(inv_h,i,i) = value_mult(sub_determinant,deno1);
181  }
182  /* calcul des sub_determinants des Aij (i<j) */
183  switch(infer) {
184  case true:
185  for (i=1; i<=n; i++)
186  for(j=i+1; j<=n;j++){
187  matrix_sub_determinant(h,i,j,aij);
188  assert(value_one_p(aij[0]));
189  MATRIX_ELEM(inv_h,j,i) = value_mult(aij[1],deno1);
190  }
191  break;
192  case false:
193  for (i=1; i<=n; i++)
194  for(j=1; j<i; j++){
195  matrix_sub_determinant(h,i,j,aij);
196  assert(value_one_p(aij[0]));
197  MATRIX_ELEM(inv_h,j,i) = value_mult(aij[1],deno1);
198  }
199  break;
200  }
201  MATRIX_DENOMINATOR(h) = deno;
202 }
#define value_oppose(ref)
#define value_product(v, w)
#define value_neg_p(val)
void matrix_sub_determinant(Pmatrix a, int i, int j, result)
void matrix_sub_determinant(Pmatrix a,int i, int j, int result[]) calculate sub determinant of a matr...
Definition: determinant.c:149
bool matrix_triangular_p(Pmatrix Z, bool inferieure)
bool matrix_triangular_p(Pmatrix Z, bool inferieure): test de triangularite de la matrice Z
Definition: matrix.c:367

References assert, MATRIX_DENOMINATOR, MATRIX_ELEM, matrix_hermite_rank(), MATRIX_NB_LINES, matrix_nulle(), matrix_sub_determinant(), matrix_triangular_p(), pgcd, value_division, value_mult, value_neg_p, value_notone_p, VALUE_ONE, value_one_p, value_oppose, value_pos_p, and value_product.

Referenced by matrix_general_inversion().

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

◆ matrix_triangular_p()

bool matrix_triangular_p ( Pmatrix  Z,
bool  inferieure 
)

bool matrix_triangular_p(Pmatrix Z, bool inferieure): test de triangularite de la matrice Z

si inferieure == true QQ i dans [1..n] QQ j dans [i+1..m] Z(i,j) == 0

si inferieure == false (triangulaire superieure) QQ i dans [1..n] QQ j dans [1..i-1] Z(i,j) == 0

Les parametres de la fonction :

int Z[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice

Parameters
inferieurenferieure

Definition at line 367 of file matrix.c.

368 {
369  int m = MATRIX_NB_LINES(Z);
370  int n = MATRIX_NB_COLUMNS(Z);
371  int i,j;
372  for (i=1; i<=m; i++)
373  if(inferieure) {
374  for (j=i+1; j<=n; j++)
375  if(MATRIX_ELEM(Z,i,j)!=0)
376  return false;
377  }
378  else
379  for (j=1; j<=i-1; j++)
380  if(MATRIX_ELEM(Z,i,j)!=0)
381  return false;
382  return true;
383 }

References MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.

Referenced by matrix_triangular_inversion(), and matrix_triangular_unimodular_p().

+ Here is the caller graph for this function:

◆ matrix_triangular_unimodular_p()

bool matrix_triangular_unimodular_p ( Pmatrix  Z,
bool  inferieure 
)

bool matrix_triangular_unimodular_p(Pmatrix Z, bool inferieure) test de la triangulaire et unimodulaire de la matrice Z.

si inferieure == true QQ i dans [1..n] QQ j dans [i+1..n] Z(i,j) == 0 i dans [1..n] Z(i,i) == 1

si inferieure == false (triangulaire superieure) QQ i dans [1..n] QQ j dans [1..i-1] Z(i,j) == 0 i dans [1..n] Z(i,i) == 1 les parametres de la fonction : matrice Z : la matrice entre

Parameters
inferieurenferieure

Definition at line 403 of file matrix.c.

404 {
405  int m = MATRIX_NB_LINES(Z);
406  assert(MATRIX_NB_COLUMNS(Z) == m);
407  bool triangulaire = matrix_triangular_p(Z,inferieure);
408  if (triangulaire) {
409  int i;
410  for(i=1; i<=m; i++)
411  if (value_notone_p(MATRIX_ELEM(Z,i,i)))
412  return false;
413  return true;
414  }
415  else
416  return false;
417 }

References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, matrix_triangular_p(), and value_notone_p.

Referenced by extract_lattice(), matrix_unimodular_inversion(), and matrix_unimodular_triangular_inversion().

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

◆ matrix_uminus()

void matrix_uminus ( Pmatrix  A,
Pmatrix  mA 
)

void matrix_uminus(A, mA)

computes mA = - A

input: A, larger allocated mA output: none modifies: mA

Parameters
mAA

Definition at line 558 of file matrix.c.

559 {
562 
563  int i,j;
564  for (i=1; i<=MATRIX_NB_LINES(A); i++)
565  for (j=1; j<=MATRIX_NB_COLUMNS(A); j++)
566  MATRIX_ELEM(mA, i, j) = value_uminus(MATRIX_ELEM(A, i, j));
567 }

References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, MATRIX_NB_LINES, and value_uminus.

Referenced by extract_lattice().

+ Here is the caller graph for this function:

◆ matrix_unimodular_inversion()

void matrix_unimodular_inversion ( Pmatrix  u,
Pmatrix  inv_u 
)

void matrix_unimodular_inversion(Pmatrix u, Pmatrix inv_u) calcul de l'inversion de la matrice unimodulaire.

algorithme :

  1. calcul la forme hermite de la matrice u : PUQ = H_U (unimodulaire triangulaire); -1 -1
  2. U = Q (H_U) P.

les parametres de la fonction : matrice u : matrice unimodulaire -— input matrice inv_u : l'inversion de u -— output int n : dimension de la matrice -— input

ne utilise pas

test

Parameters
inv_unv_u

Definition at line 261 of file inversion.c.

265 {
266  int n = MATRIX_NB_LINES(u);
267  Pmatrix p = matrix_new(n,n);
268  Pmatrix q = matrix_new(n,n);
269  Pmatrix h_u = matrix_new(n,n);
270  Pmatrix inv_h_u = matrix_new(n,n);
271  Pmatrix temp = matrix_new(n,n);
272  Value det_p,det_q; /* ne utilise pas */
273 
274  /* test */
276 
277  matrix_hermite(u,p,h_u,q,&det_p,&det_q);
279  matrix_unimodular_triangular_inversion(h_u,inv_h_u,true);
280  matrix_multiply(q,inv_h_u,temp);
281  matrix_multiply(temp,p,inv_u);
282 }
void matrix_unimodular_triangular_inversion(Pmatrix u, Pmatrix inv_u, bool infer)
package matrix
Definition: inversion.c:53
bool matrix_triangular_unimodular_p(Pmatrix Z, bool inferieure)
bool matrix_triangular_unimodular_p(Pmatrix Z, bool inferieure) test de la triangulaire et unimodulai...
Definition: matrix.c:403

References assert, MATRIX_DENOMINATOR, matrix_hermite(), matrix_multiply(), MATRIX_NB_LINES, matrix_new(), matrix_triangular_unimodular_p(), matrix_unimodular_triangular_inversion(), and value_one_p.

+ Here is the call graph for this function:

◆ matrix_unimodular_triangular_inversion()

void matrix_unimodular_triangular_inversion ( Pmatrix  u,
Pmatrix  inv_u,
bool  infer 
)

inversion.c

inversion.c

void matrix_unimodular_triangular_inversion(Pmatrix u ,Pmatrix inv_u,

  • bool infer) u soit le matrice unimodulaire triangulaire. si infer = true (triangulaire inferieure), infer = false (triangulaire superieure). calcul de l'inversion de matrice u telle que I = U x INV_U . Les parametres de la fonction :

Pmatrix u : matrice unimodulaire triangulaire – inpout int n : dimension de la matrice caree – inpout bool infer : type de triangulaire – input matrice inv_u : l'inversion de matrice u – output

test de l'unimodularite et de la trangularite de u

Parameters
inv_unv_u
infernfer

Definition at line 53 of file inversion.c.

57 {
58  int i, j;
59  Value x;
60  int n = MATRIX_NB_LINES(u);
61  /* test de l'unimodularite et de la trangularite de u */
63 
64  matrix_identity(inv_u,0);
65  if (infer){
66  for (i=n; i>=1;i--)
67  for (j=i-1; j>=1; j--){
68  x = MATRIX_ELEM(u,i,j);
69  if (value_notzero_p(x))
70  matrix_subtraction_column(inv_u,j,i,x);
71  }
72  }
73  else{
74  for (i=1; i<=n; i++)
75  for(j=i+1; j<=n; j++){
76  x = MATRIX_ELEM(u,i,j);
77  if (value_notzero_p(x))
78  matrix_subtraction_column(inv_u,j,i,x);
79  }
80  }
81 }

References assert, MATRIX_ELEM, matrix_identity(), MATRIX_NB_LINES, matrix_subtraction_column(), matrix_triangular_unimodular_p(), value_notzero_p, and x.

Referenced by extract_lattice(), and matrix_unimodular_inversion().

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

◆ ordinary_sub_matrix()

void ordinary_sub_matrix ( Pmatrix  A,
Pmatrix  A_sub,
int  i1,
int  i2,
int  j1,
int  j2 
)

void ordinary_sub_matrix(Pmatrix A, A_sub, int i1, i2, j1, j2) input : a initialized matrix A, an uninitialized matrix A_sub, which dimensions are i2-i1+1 and j2-j1+1.

output : nothing. modifies : A_sub is initialized with the elements of A which coordinates range within [i1,i2] and [j1,j2]. comment : A_sub must be already allocated.

Parameters
A_sub_sub
i11
i22
j11
j22

Definition at line 469 of file sub-matrix.c.

472 {
473  int i, j, i_sub, j_sub;
474 
475  for(i = i1, i_sub = 1; i <= i2; i++, i_sub ++)
476  for(j = j1, j_sub = 1; j <= j2; j++, j_sub ++)
477  MATRIX_ELEM(A_sub,i_sub,j_sub) = MATRIX_ELEM(A,i,j);
478 
479 }

References MATRIX_ELEM.

Referenced by extract_lattice(), and region_sc_minimal().

+ Here is the caller graph for this function: