PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include "linear_assert.h"
#include "boolean.h"
#include "arithmetique.h"
#include "matrix.h"
Go to the source code of this file.
Macros | |
#define | MALLOC(s, t, f) malloc(s) |
package matrix More... | |
#define | FREE(s, t, f) free(s) |
Functions | |
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-matrice MAT(level+1 ..n, level+1 ..m) More... | |
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). More... | |
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)). More... | |
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. More... | |
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 More... | |
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 More... | |
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) More... | |
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. More... | |
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. More... | |
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. More... | |
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) More... | |
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. More... | |
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 More... | |
Definition at line 52 of file sub-matrix.c.
package matrix
ce fichier comporte les routines traitant des sous-matrices inferieures droites; ces routines traitent la matrice toute entiere si le parametre level vaut 0; les routines sur les matrices completes se trouvent dans le fichier matrice.c J'ai rajoute' une fonction peremttant d'extraire une sous matrice quelconque d'une matrice donne'e BC, Sept 94
Definition at line 51 of file sub-matrix.c.
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
A_sub | _sub |
i1 | 1 |
i2 | 2 |
j1 | 1 |
j2 | 2 |
Definition at line 487 of file sub-matrix.c.
References assert, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.
Referenced by extract_lattice().
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
MAT | AT |
lg_nnul | g_nnul |
cl_nnul | l_nnul |
level | evel |
Definition at line 421 of file sub-matrix.c.
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().
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
MAT | AT |
level | evel |
Definition at line 401 of file sub-matrix.c.
References level, MATRIX_ELEM, and MATRIX_NB_LINES.
Referenced by matrix_smith(), and smith_int().
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
ID | D |
level | evel |
Definition at line 322 of file sub-matrix.c.
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().
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
ID | D |
level | evel |
Definition at line 352 of file sub-matrix.c.
References level, MATRIX_ELEM, MATRIX_NB_LINES, value_notone_p, and value_notzero_p.
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)
MAT | AT |
level | evel |
Definition at line 379 of file sub-matrix.c.
References level, MATRIX_ELEM, and MATRIX_NB_COLUMNS.
Referenced by matrix_hermite(), matrix_smith(), and smith_int().
int matrix_line_nnul(matrice MAT,int level): Recherche de la premiere ligne non nulle de la la sous-matrice MAT(level+1 ..n, level+1 ..m)
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...
MAT | AT |
level | evel |
Definition at line 72 of file sub-matrix.c.
References level, MATRIX_ELEM, MATRIX_NB_COLUMNS, and MATRIX_NB_LINES.
Referenced by matrix_coeff_nnul().
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
level | evel |
Definition at line 256 of file sub-matrix.c.
References level, MATRIX_ELEM, matrix_identity(), MATRIX_NB_LINES, SUB_MATRIX_ELEM, value_division, value_uminus, and x.
Referenced by smith_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
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
level | evel |
Definition at line 294 of file sub-matrix.c.
References level, MATRIX_ELEM, matrix_identity(), MATRIX_NB_COLUMNS, Q, SUB_MATRIX_ELEM, value_div, value_uminus, and x.
Referenced by smith_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.
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
MAT | AT |
i_min | _min |
j_min | _min |
level | evel |
Definition at line 196 of file sub-matrix.c.
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().
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
MAT | AT |
level | evel |
Definition at line 115 of file sub-matrix.c.
References level, MATRIX_ELEM, MATRIX_NB_LINES, matrix_nulle(), and VALUE_ONE.
Referenced by smith_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)).
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
MAT | AT |
level | evel |
Definition at line 150 of file sub-matrix.c.
References level, MATRIX_ELEM, MATRIX_NB_COLUMNS, matrix_nulle(), SUB_MATRIX_ELEM, and VALUE_ONE.
Referenced by smith_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.
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.
A_sub | _sub |
i1 | 1 |
i2 | 2 |
j1 | 1 |
j2 | 2 |
Definition at line 469 of file sub-matrix.c.
References MATRIX_ELEM.
Referenced by extract_lattice(), and region_sc_minimal().