00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __MATRICE_H_
00029 #define __MATRICE_H_
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 #include <stdio.h>
00127
00128 #include "type_parite.h"
00129 #include "tbl.h"
00130 #include "itbl.h"
00131
00145 class Matrice {
00146
00147 private:
00148
00149 int etat ;
00150
00151 Tbl* std ;
00152
00153
00154 mutable int ku ;
00155 mutable int kl ;
00156
00163 mutable Tbl* band ;
00164
00165
00166 mutable Tbl* lu ;
00167 mutable Itbl* permute ;
00168
00169
00170 public:
00177 Matrice (int size1, int size2 ) ;
00178
00179 Matrice (const Matrice& ) ;
00180
00189 Matrice (const Tbl& tab) ;
00190
00191 ~Matrice() ;
00192
00193
00199 private:
00200 void del_t() ;
00201 void del_deriv() ;
00202
00203
00204 public:
00206 int get_etat() const { return etat ; };
00207
00213 void set_etat_qcq() ;
00214
00220 void set_etat_zero() ;
00221
00226 void set_etat_nondef() ;
00227
00232 void annule_hard() ;
00233
00234
00235 public:
00241 int get_dim(int i) const ;
00242
00244 Tbl get_array() const {return *std; } ;
00245
00246
00247 public:
00252 void operator=(double x) ;
00253
00254 void operator=(const Matrice& ) ;
00255 void operator=(const Tbl& ) ;
00256
00257
00258 friend ostream& operator<<(ostream& , const Matrice& ) ;
00259
00260
00261 public:
00270 double& set(int j, int i) {
00271 assert (etat == ETATQCQ) ;
00272 assert ((i>=0) && (i<std->dim.dim[0])) ;
00273 assert( (j>=0) && (j<std->dim.dim[1]) ) ;
00274 if ( (band != 0x0) || (lu != 0x0) ) del_deriv() ;
00275 return std->t[std->dim.dim[0] * j + i] ;
00276 } ;
00277
00283 double operator()(int j , int i) const {
00284 assert(etat != ETATNONDEF) ;
00285 assert( (i>=0) && (i<std->dim.dim[0]) ) ;
00286 assert( (j>=0) && (j<std->dim.dim[1]) ) ;
00287 if (etat == ETATZERO) {
00288 double zero = 0. ;
00289 return zero ;
00290 }
00291 else return std->t[std->dim.dim[0] * j + i] ;
00292 };
00293
00294
00302 void set_band (int up, int low) const ;
00303
00304
00309 void set_lu () const ;
00310
00311
00318 Tbl inverse (const Tbl& sec_membre) const ;
00319
00320
00327 Tbl val_propre() const ;
00332 Matrice vect_propre() const ;
00333
00338 double determinant() const ;
00339
00343 Matrice transpose() const ;
00344
00345
00346
00347
00348 public:
00350 void operator+=(const Matrice &) ;
00351 void operator+=(double) ;
00352
00353 void operator-=(const Matrice &) ;
00354 void operator-=(double) ;
00355 void operator*=(double) ;
00356 void operator/=(double) ;
00357
00358
00359 friend Matrice operator+ (const Matrice&, const Matrice& ) ;
00360 friend Matrice operator- (const Matrice&, const Matrice& ) ;
00361 friend Matrice operator* (const Matrice&, double ) ;
00362 friend Matrice operator* (double, const Matrice& ) ;
00363 friend Matrice operator* (const Matrice&, const Matrice& ) ;
00364 friend Matrice operator/ (const Matrice&, double ) ;
00365 } ;
00366 ostream& operator<<(ostream& , const Matrice& ) ;
00367
00373 Matrice operator+ (const Matrice&, const Matrice& ) ;
00374 Matrice operator- (const Matrice&, const Matrice& ) ;
00375 Matrice operator* (const Matrice&, double ) ;
00376 Matrice operator* (double, const Matrice& ) ;
00377 Matrice operator* (const Matrice&, const Matrice& ) ;
00378 Matrice operator/ (const Matrice&, double ) ;
00379
00382 #endif