source: pacpusframework/trunk/include/Pacpus/PacpusTools/matrice.h@ 36

Last change on this file since 36 was 3, checked in by sgosseli, 12 years ago
  • Add the existing Pacpus files from pacpusdev and pacpuscore.
  • Provide a clean build system based on multiple CMake files.
File size: 2.0 KB
Line 
1#ifndef MATRIX_H
2#define MATRIX_H
3
4typedef enum
5{
6 ONES,
7 ZEROS,
8 IDENTITY
9} t_m;
10
11class matrice
12{
13 typedef double *ligne;
14 ligne *lignes;
15 unsigned short int n; // Nombre de lignes (1erparamètre).
16 unsigned short int m; // Nombre de colonnes (2èmeparamètre).
17
18public:
19 //constructeurs
20 matrice();
21 matrice(unsigned short int nl, unsigned short int nc);
22 matrice(unsigned short int nl, unsigned short int nc,t_m type);
23 matrice(const matrice &source); //constructeur par copie
24 //destructeur
25 virtual ~matrice(void);
26 void Alloue(unsigned short int nl, unsigned short int nc); //allocation de la matrice
27
28 // fonction pour le calcul de matrice
29 matrice &operator=(const matrice &m);//m=m1
30 matrice &operator=(double x); //m=x
31 operator double()const{return **lignes;}
32
33 matrice &operator+=(const matrice &m); //m+=m1
34 matrice &operator-=(const matrice &m); //m-=m1
35
36 matrice operator+(const matrice &m1) const; //m=m1+m2
37 matrice operator-(const matrice &m1) const; //m=m1-m2
38 matrice operator*(const matrice &m1) const; //m=m1*m2
39
40 matrice &operator+=(double x); //m+=x
41 matrice &operator-=(double x); //m-=x
42
43 matrice operator+(double x)const; //m+x
44 matrice operator-(double x)const; //m-x
45 matrice operator*(double x)const; //m*x
46 matrice operator/(double x)const; //m/x
47
48 friend matrice operator+(double x,matrice m1) {return m1+x ;} // x+m ;
49 friend matrice operator-(double x,matrice m1) {return m1-x ;} // x-m ;
50 friend matrice operator*(double x,matrice m1) {return m1*x ;} // x*m ;
51
52 matrice T(); //transposition
53 matrice I(); //inversion
54
55 double &operator()(unsigned short int i, unsigned short int j); // ecriture m(i,j)=x
56 double operator()(unsigned short int i, unsigned short int j) const; //lecture x=m(i,j)
57 double &operator()(unsigned short int i); // ecriture m(i)=x
58 double operator()(unsigned short int i) const; //lecture x=m(i)
59
60 void print(const char *nom);
61};
62
63#endif // MATRIX_H
Note: See TracBrowser for help on using the repository browser.