PIPS
matrice.h
Go to the documentation of this file.
1 /* Warning! Do not modify this file that is automatically generated! */
2 /* Modify src/Libs/matrice/matrice-local.h instead, to add your own modifications. */
3 
4 /* header file built by cproto */
5 
6 #ifndef matrice_header_included
7 #define matrice_header_included
8 /* matrice-local.h */
9 /*
10 
11  $Id: matrice-local.h 1641 2016-03-02 08:20:19Z coelho $
12 
13  Copyright 1989-2016 MINES ParisTech
14 
15  This file is part of Linear/C3 Library.
16 
17  Linear/C3 Library is free software: you can redistribute it and/or modify it
18  under the terms of the GNU Lesser General Public License as published by
19  the Free Software Foundation, either version 3 of the License, or
20  any later version.
21 
22  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
23  WARRANTY; without even the implied warranty of MERCHANTABILITY or
24  FITNESS FOR A PARTICULAR PURPOSE.
25 
26  See the GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
30 
31 */
32 
33 /* package matrice
34  *
35  * Neil Butler, Corinne Ancourt, Francois Irigoin, Yi-qing Yang
36  *
37  */
38 
39 #if defined(__GNUC__)
40 // Comment this warning since no one has fixed this issue since the 90's...
41 //#warning matrice is obsolete, use matrix instead.
42 #endif
43 
44 /* Les matrices sont des matrices pleines, a coefficients rationnels.
45  *
46  * Les matrices sont representes par des tableaux d'entiers mono-dimensionnels
47  * dont l'element 0 represente le denominateur global. Elles sont
48  * stockees par colonne ("column-major"), comme en Fortran. Les indices
49  * commencent a 1, toujours comme en Fortran et non comme en C.
50  * Les deux dimensions sont implicites et doivent etre passees en
51  * parametre avec la matrice dans les appels de procedures.
52  *
53  * Le denominateur doit etre strictement positif, i.e. plus grand ou egal
54  * a un. Un denominateur nul n'aurait pas de sens. Un denominateur negatif
55  * doublerait le nombre de representations possibles d'une matrice.
56  *
57  * Les matrices renvoyees par certaines routines, comme matrice_multiply(),
58  * ne sont pas normalisees par le pgcd des coefficients et du denominateur
59  * pour des raisons d'efficacite. Mais les routines de test, comme
60  * matrice_identite_p(), supposent leurs arguments normalises.
61  *
62  * Il faudrait sans doute introduire deux niveaux de procedure, un niveau
63  * externe sur garantissant la normalisation, et un niveau interne efficace
64  * sans normalisation automatique.
65  *
66  * La bibliotheque utilise une notion de sous-matrice, definie systematiquement
67  * par un parametre appele "level". Seuls les elements dont les indices
68  * de lignes et de colonnes sont superieurs a level+1 (ou level? FI->CA)
69  * sont pris en consideration. Il s'agit donc de sous-matrice dont le
70  * premier element se trouve sur la diagonale de la matrice complete et
71  * dont le dernier element et le dernier element de la matrice complete.
72  *
73  * Note: en cas detection d'incoherence, Neil Butler renvoyait un code
74  * d'erreur particulier; Francois Irigoin a supprime ces codes de retour
75  * et a traite les exceptions par des appels a assert(), et indirectement
76  * a abort()
77  */
78 
79 typedef Value * matrice;
80 
81 #define MATRICE_UNDEFINED ((matrice) NULL)
82 #define MATRICE_NULLE ((matrice) NULL)
83 
84 /* Allocation et desallocation d'une matrice */
85 #define matrice_new(n,m) ((matrice) malloc(sizeof(Value)*((n*m)+1)))
86 #define matrice_free(m) (free((char *) (m)))
87 
88 /* Macros d'acces aux elements d'une matrice */
89 
90 /* int ACCESS(int * matrix, int column, int i, int j): acces a l'element (i,j)
91  * de la matrice matrix, dont la taille des colonnes, i.e. le nombre de
92  * lignes, est column.
93  */
94 #define ACCESS(matrix,column,i,j) ((matrix)[(((j)-1)*(column))+(i)])
95 
96 /* int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix
97  * La combinaison *(&()) est necessaire pour avoir des parentheses autour
98  * de matrix[0] et pour pouvoir simultanement utiliser cette macro comme lhs.
99  */
100 /* #define DENOMINATOR(matrix) *(&((matrix)[0])) */
101 #define DENOMINATOR(matrix) ((matrix)[0])
102 
103 /* bool matrice_triangulaire_inferieure_p(matrice a, int n, int m):
104  * test de triangularite de la matrice a
105  */
106 #define matrice_triangulaire_inferieure_p(a,n,m) \
107  matrice_triangulaire_p(a,n,m,true)
108 
109 /* bool matrice_triangulaire_superieure_p(matrice a, int n, int m):
110  * test de triangularite de la matrice a
111  */
112 #define matrice_triangulaire_superieure_p(a,n,m) \
113  matrice_triangulaire_p(a,n,m,false)
114 
115 /* FI: Corinne, peux-tu expliquer la raison d'etre de cette macro? */
116 /* d'apres ce que je comprends de la suite, ca permet de definir
117  * des sous-matrices dont le coin superieur droit (i.e. le premier
118  * element) se trouve sur la diagonal?
119  */
120 #define ACC_ELEM(matrix,column,i,j,level) \
121  (matrix[((j)-1+(level))*(column) + (i) + (level)])
122 
123 /* FI: Corinne, pourrais-tu nous eclairer sur la signification de ces
124  * constantes?
125  */
126 #define VALIDATION 0
127 /* FI #define NULL 0 */
128 #define MATRIX 0
129 
130 /* definition temporaire d'une vraie fonction pour dbx */
131 /* #define matrice_print(a,n,m) matrice_fprint(stdout,a,n,m) */
132 /* cproto-generated files */
133 /* determinant.c */
134 extern void matrice_determinant(matrice /*a*/, int /*n*/, Value /*result*/[]);
135 extern void matrice_sous_determinant(matrice /*a*/, int /*n*/, int /*i*/, int /*j*/, Value /*result*/[]);
136 /* hermite.c */
137 extern void matrice_hermite(Value */*MAT*/, int /*n*/, int /*m*/, Value */*P*/, Value */*H*/, Value */*Q*/, Value */*det_p*/, Value */*det_q*/);
138 extern int matrice_hermite_rank(matrice /*a*/, int /*n*/, int /*m*/);
139 extern int dim_H(matrice /*H*/, int /*n*/, int /*m*/);
140 /* inversion.c */
141 extern void matrice_unimodulaire_triangulaire_inversion(matrice /*u*/, matrice /*inv_u*/, int /*n*/, bool /*infer*/);
142 extern void matrice_diagonale_inversion(matrice /*s*/, matrice /*inv_s*/, int /*n*/);
143 extern void matrice_triangulaire_inversion(matrice /*h*/, matrice /*inv_h*/, int /*n*/, bool /*infer*/);
144 extern void matrice_general_inversion(matrice /*a*/, matrice /*inv_a*/, int /*n*/);
145 extern void matrice_unimodulaire_inversion(matrice /*u*/, matrice /*inv_u*/, int /*n*/);
146 /* matrice.c */
147 extern void matrice_transpose(matrice /*a*/, matrice /*a_t*/, int /*n*/, int /*m*/);
148 extern void matrice_multiply(matrice /*a*/, matrice /*b*/, matrice /*c*/, int /*p*/, int /*q*/, int /*r*/);
149 extern void matrice_normalize(matrice /*a*/, int /*n*/, int /*m*/);
150 extern void matrice_normalizec(matrice /*MAT*/, int /*n*/, int /*m*/);
151 extern void matrice_swap_columns(matrice /*matrix*/, int /*n*/, int /*m*/, int /*c1*/, int /*c2*/);
152 extern void matrice_swap_rows(matrice /*a*/, int /*n*/, int /*m*/, int /*r1*/, int /*r2*/);
153 extern void matrice_assign(matrice /*A*/, matrice /*B*/, int /*n*/, int /*m*/);
154 extern bool matrice_egalite(matrice /*A*/, matrice /*B*/, int /*n*/, int /*m*/);
155 extern void matrice_nulle(matrice /*Z*/, int /*n*/, int /*m*/);
156 extern bool matrice_nulle_p(matrice /*Z*/, int /*n*/, int /*m*/);
157 extern bool matrice_diagonale_p(matrice /*Z*/, int /*n*/, int /*m*/);
158 extern bool matrice_triangulaire_p(matrice /*Z*/, int /*n*/, int /*m*/, bool /*inferieure*/);
159 extern bool matrice_triangulaire_unimodulaire_p(matrice /*Z*/, int /*n*/, bool /*inferieure*/);
160 extern void matrice_substract(matrice /*a*/, matrice /*b*/, matrice /*c*/, int /*n*/, int /*m*/);
161 extern void matrice_soustraction_colonne(matrice /*MAT*/, int /*n*/, int /*m*/, int /*c1*/, int /*c2*/, Value /*x*/);
162 extern void matrice_soustraction_ligne(matrice /*MAT*/, int /*n*/, int /*m*/, int /*r1*/, int /*r2*/, Value /*x*/);
163 /* matrice_io.c */
164 extern void matrice_fprint(FILE */*f*/, matrice /*a*/, int /*n*/, int /*m*/);
165 extern void matrice_print(matrice /*a*/, int /*n*/, int /*m*/);
166 extern void matrice_fscan(FILE */*f*/, matrice */*a*/, int */*n*/, int */*m*/);
167 /* smith.c */
168 extern void matrice_smith(matrice /*MAT*/, int /*n*/, int /*m*/, matrice /*P*/, matrice /*D*/, matrice /*Q*/);
169 /* sous-matrice.c */
170 extern int mat_lig_nnul(matrice /*MAT*/, int /*n*/, int /*m*/, int /*level*/);
171 extern void mat_perm_col(matrice /*MAT*/, int /*n*/, int /*m*/, int /*k*/, int /*level*/);
172 extern void mat_perm_lig(matrice /*MAT*/, int /*n*/, int /*m*/, int /*k*/, int /*level*/);
173 extern void mat_min(matrice /*MAT*/, int /*n*/, int /*m*/, int */*i_min*/, int */*j_min*/, int /*level*/);
174 extern void mat_maj_col(matrice /*A*/, int /*n*/, int /*m*/, matrice /*P*/, int /*level*/);
175 extern void mat_maj_lig(matrice /*A*/, int /*n*/, int /*m*/, matrice /*Q*/, int /*level*/);
176 extern void matrice_identite(matrice /*ID*/, int /*n*/, int /*level*/);
177 extern bool matrice_identite_p(matrice /*ID*/, int /*n*/, int /*level*/);
178 extern int mat_lig_el(matrice /*MAT*/, int /*n*/, int /*m*/, int /*level*/);
179 extern int mat_col_el(matrice /*MAT*/, int /*n*/, int /*m*/, int /*level*/);
180 extern void mat_coeff_nnul(matrice /*MAT*/, int /*n*/, int /*m*/, int */*lg_nnul*/, int */*cl_nnul*/, int /*level*/);
181 #endif /* matrice_header_included */
int Value
Value * matrice
package matrice
Definition: matrice-local.h:71
int mat_lig_nnul(matrice, int, int, int)
sous-matrice.c
Definition: sous-matrice.c:65
void matrice_fscan(FILE *, matrice *, int *, int *)
void matrice_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCI...
Definition: matrice_io.c:115
int matrice_hermite_rank(matrice, int, int)
void matrice_soustraction_colonne(matrice, int, int, int, int, Value)
int dim_H(matrice, int, int)
Calcul de la dimension de la matrice de Hermite H.
Definition: hermite.c:197
int mat_lig_el(matrice, int, int, int)
int mat_lig_el(matrice MAT, int n, int m, int level) renvoie le numero de colonne absolu du premier e...
Definition: sous-matrice.c:381
void mat_maj_col(matrice, int, int, matrice, int)
void matrice_sous_determinant(matrice, int, int, int, Value[])
void matrice_soustraction_ligne(matrice, int, int, int, int, Value)
void matrice_soustraction_ligne(matrice MAT,int n,int m,int r1,int r2,int x): Soustrait x fois la lig...
Definition: matrice.c:554
void matrice_triangulaire_inversion(matrice, matrice, int, bool)
void matrice_triangulaire_inversion(matrice h, matrice inv_h, int n,bool infer) calcul de l'inversion...
Definition: inversion.c:140
void mat_coeff_nnul(matrice, int, int, int *, int *, int)
void mat_coeff_nnul(matrice MAT, int n, int m, int * lg_nnul, int * cl_nnul, int level) renvoie les c...
Definition: sous-matrice.c:426
void matrice_hermite(Value *, int, int, Value *, Value *, Value *, Value *, Value *)
hermite.c
Definition: hermite.c:78
Value * matrice
Warning! Do not modify this file that is automatically generated!
Definition: matrice.h:79
bool matrice_triangulaire_p(matrice, int, int, bool)
bool matrice_triangulaire_p(matrice Z, int n, int m, bool inferieure): test de triangularite de la ma...
Definition: matrice.c:394
void matrice_multiply(matrice, matrice, matrice, int, int, int)
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r): multiply rational matrix...
Definition: matrice.c:82
void mat_min(matrice, int, int, int *, int *, int)
void mat_min(matrice MAT, int n, int m, int * i_min, int * j_min, int level): Recherche des coordonne...
Definition: sous-matrice.c:193
void matrice_diagonale_inversion(matrice, matrice, int)
void matrice_diagonale_inversion(matrice s,matrice inv_s,int n) calcul de l'inversion du matrice en f...
Definition: inversion.c:95
void mat_perm_lig(matrice, int, int, int, int)
void matrice_identite(matrice, int, int)
void matrice_identite(matrice ID, int n, int level) Construction d'une sous-matrice identite dans ID(...
Definition: sous-matrice.c:322
void matrice_print(matrice, int, int)
void matrice_print(matrice a, int n, int m): print an (nxm) rational matrix
Definition: matrice_io.c:90
bool matrice_triangulaire_unimodulaire_p(matrice, int, bool)
bool matrice_triangulaire_unimodulaire_p(matrice Z, int n, bool inferieure) test de la triangulaire e...
Definition: matrice.c:434
void matrice_unimodulaire_triangulaire_inversion(matrice, matrice, int, bool)
inversion.c
Definition: inversion.c:54
bool matrice_egalite(matrice, matrice, int, int)
bool matrice_egalite(matrice A, matrice B, int n, int m) test de l'egalite de deux matrices A et B; e...
Definition: matrice.c:285
void matrice_smith(matrice, int, int, matrice, matrice, matrice)
smith.c
Definition: smith.c:68
void matrice_determinant(matrice, int, Value[])
definition temporaire d'une vraie fonction pour dbx
void matrice_normalizec(matrice, int, int)
void matrice_normalizec(matrice MAT, int n, int m): Normalisation des coefficients de la matrice MAT,...
Definition: matrice.c:175
void matrice_swap_rows(matrice, int, int, int, int)
void matrice_swap_rows(matrice a, int n, int m, int r1, int r2): exchange rows r1 and r2 of an (nxm) ...
Definition: matrice.c:230
void matrice_substract(matrice, matrice, matrice, int, int)
void matrice_substract(matrice a, matrice b, matrice c, int n, int m): substract rational matrix c fr...
Definition: matrice.c:468
bool matrice_diagonale_p(matrice, int, int)
bool matrice_diagonale_p(matrice Z, int n, int m): test de nullite de la matrice Z
Definition: matrice.c:362
void matrice_assign(matrice, matrice, int, int)
void matrice_assign(matrice A, matrice B, int n, int m) Copie de la matrice A dans la matrice B
Definition: matrice.c:264
void matrice_fprint(FILE *, matrice, int, int)
matrice_io.c
Definition: matrice_io.c:62
void mat_maj_lig(matrice, int, int, matrice, int)
void mat_maj_lig(matrice A, int n, int m, matrice Q, int level): Calcul de la matrice permettant de r...
Definition: sous-matrice.c:292
void matrice_nulle(matrice, int, int)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
void matrice_normalize(matrice, int, int)
void matrice_normalize(matrice a, int n, int m)
Definition: matrice.c:125
bool matrice_identite_p(matrice, int, int)
bool matrice_identite_p(matrice ID, int n, int level) test d'une sous-matrice dans ID(level+1....
Definition: sous-matrice.c:353
void matrice_transpose(matrice, matrice, int, int)
matrice.c
Definition: matrice.c:48
void mat_perm_col(matrice, int, int, int, int)
int mat_col_el(matrice, int, int, int)
void matrice_general_inversion(matrice, matrice, int)
void matrice_general_inversion(matrice a; matrice inv_a; int n) calcul de l'inversion du matrice gene...
Definition: inversion.c:222
bool matrice_nulle_p(matrice, int, int)
bool matrice_nulle_p(matrice Z, int n, int m): test de nullite de la matrice Z
Definition: matrice.c:336
void matrice_swap_columns(matrice, int, int, int, int)
void matrice_swap_columns(matrice matrix, int n, int m, int c1, int c2): exchange columns c1,...
Definition: matrice.c:200
void matrice_unimodulaire_inversion(matrice, matrice, int)
void matrice_unimodulaire_inversion(matrice u, matrice inv_u, int n) calcul de l'inversion de la matr...
Definition: inversion.c:267