1 |
souaissa |
108 |
|
2 |
|
|
//---------------------------------------------------------------------------
|
3 |
|
|
|
4 |
|
|
#ifndef sl_matpleineH
|
5 |
|
|
#define sl_matpleineH
|
6 |
|
|
//---------------------------------------------------------------------------
|
7 |
|
|
#include <iostream>
|
8 |
|
|
#include <vector.h>
|
9 |
|
|
#include <assert>
|
10 |
|
|
|
11 |
souaissa |
161 |
#include "sl_vecteur.h"
|
12 |
souaissa |
108 |
|
13 |
|
|
#ifdef WINDOWS_VERSION
|
14 |
|
|
#ifdef BUILT_DLL_SOLVEUR
|
15 |
|
|
#define DLLPORTSOLVEUR __declspec(dllexport)
|
16 |
|
|
#else
|
17 |
|
|
#define DLLPORTSOLVEUR __declspec(dllimport)
|
18 |
|
|
#endif
|
19 |
|
|
#else
|
20 |
|
|
#define DLLPORTSOLVEUR
|
21 |
|
|
#endif
|
22 |
|
|
|
23 |
souaissa |
161 |
class DLLPORTSOLVEUR vecteur;
|
24 |
souaissa |
108 |
|
25 |
|
|
|
26 |
|
|
class DLLPORTSOLVEUR Matrice
|
27 |
|
|
{
|
28 |
|
|
private:
|
29 |
souaissa |
161 |
int NbRows;
|
30 |
|
|
int NbCols;
|
31 |
souaissa |
108 |
double** Data;
|
32 |
|
|
|
33 |
|
|
public:
|
34 |
souaissa |
161 |
friend class DLLPORTSOLVEUR vecteur;
|
35 |
souaissa |
108 |
Matrice();
|
36 |
|
|
Matrice(int Rows, int Cols,double InitVal);
|
37 |
|
|
Matrice(double* Data, int Rows, int Cols);
|
38 |
|
|
Matrice(double** Data, int Rows, int Cols);
|
39 |
|
|
|
40 |
|
|
Matrice(const Matrice& obj);
|
41 |
|
|
~Matrice();
|
42 |
|
|
Matrice& operator =(const Matrice& obj);
|
43 |
|
|
Matrice& operator +(const Matrice& obj) const;
|
44 |
|
|
Matrice& operator -(const Matrice& obj) const;
|
45 |
|
|
Matrice& operator *(const Matrice& obj) const;
|
46 |
|
|
Matrice& operator *(const double _d) const;
|
47 |
|
|
Matrice& operator /(const double _d) const;
|
48 |
|
|
Matrice& operator +=(const Matrice& obj);
|
49 |
|
|
Matrice& operator -=(const Matrice& obj);
|
50 |
|
|
Matrice& operator *=(const Matrice& obj);
|
51 |
|
|
Matrice& operator *=(const double _d);
|
52 |
|
|
Matrice& operator /=(const double _d);
|
53 |
|
|
bool operator ==(const Matrice& obj) const;
|
54 |
|
|
bool operator !=(const Matrice& obj) const;
|
55 |
|
|
double* operator [](const int _i) const;
|
56 |
souaissa |
166 |
|
57 |
souaissa |
108 |
double& operator ()(const int _i, const int _j) const;
|
58 |
|
|
bool IsIdentity() const;
|
59 |
|
|
bool IsZeroMatrice() const;
|
60 |
|
|
double Get_SumAll() const;
|
61 |
|
|
double Get_SumRow(const int Row) const;
|
62 |
|
|
double Get_SumColumn(const int Col) const;
|
63 |
|
|
double Get_Max() const;
|
64 |
|
|
double Get_Min() const;
|
65 |
|
|
double Get_AbMax() const;
|
66 |
|
|
double Get_RowMax(const int Row) const;
|
67 |
|
|
double Get_RowMin(const int Row) const;
|
68 |
|
|
double Get_ColumnMax(const int Col) const;
|
69 |
|
|
double Get_ColumnMin(const int Col) const;
|
70 |
|
|
double* Get_DataOneDimen() const;
|
71 |
|
|
double** Get_DataTwoDimen() const;
|
72 |
|
|
int Get_NbRows() const;
|
73 |
|
|
int Get_NbCols() const;
|
74 |
|
|
Matrice& Clear();
|
75 |
|
|
Matrice& ClearRow(const int Row);
|
76 |
|
|
Matrice& ClearColumn(const int Col);
|
77 |
|
|
Matrice& Fill(const double _d);
|
78 |
|
|
Matrice& FillRow(const int Row, const double _d);
|
79 |
|
|
Matrice& FillColumn(const int Col, const double _d);
|
80 |
|
|
Matrice& Get_SubMatrice(const int RowSpot, const int ColSpot, const int RowLen, const int ColLen) const ;
|
81 |
souaissa |
166 |
Matrice& Set_SubMatrice(Matrice& sub,const int RowSpot, const int ColSpot, const int RowLen, const int ColLen);
|
82 |
souaissa |
108 |
Matrice& Get_SwapRows(const int Row1, const int Row2);
|
83 |
|
|
Matrice& Get_SwapCols(const int Col1, const int Col2);
|
84 |
souaissa |
161 |
Matrice& Get_Transpose() const ;
|
85 |
|
|
Matrice& Transpose();
|
86 |
souaissa |
108 |
Matrice& Get_ConMatAsRow(const Matrice& obj);
|
87 |
|
|
Matrice& Get_ConMatAsCol(const Matrice& obj);
|
88 |
|
|
Matrice& GetCMAR(const Matrice& obj) const ;
|
89 |
|
|
Matrice& GetCMAC(const Matrice& obj) const ;
|
90 |
|
|
Matrice& ConcatenateRow(const double* RowData);
|
91 |
|
|
Matrice& ConcatenateColumn(const double* ColumnData);
|
92 |
souaissa |
161 |
Matrice& Add_Row(const vecteur& RowData, const int RowSpot);
|
93 |
|
|
Matrice& Add_Column(const vecteur& ColumnData, const int ColumnSpot);
|
94 |
souaissa |
166 |
vecteur Get_Row(int i);
|
95 |
|
|
vecteur Get_Col(int j);
|
96 |
|
|
//Matrice Get_SubMatrice(int ln1,int ln2, int cl1,int cl2);
|
97 |
|
|
Matrice Get_SubMatrice(vecteur& lgn,vecteur& col);
|
98 |
souaissa |
108 |
Matrice& RemoveRow(const int Row);
|
99 |
|
|
Matrice& RemoveColumn(const int Column);
|
100 |
|
|
Matrice& Get_Covariant() const;
|
101 |
|
|
Matrice& Set_Covariant();
|
102 |
|
|
Matrice& IdentityMatrice(int Diagonal);
|
103 |
souaissa |
161 |
Matrice& Get_LU(vecteur& perm,double&d);
|
104 |
souaissa |
166 |
vecteur Get_Solution(vecteur& perm,const vecteur& b);
|
105 |
|
|
void Get_Solution(vecteur& perm, vecteur& b, vecteur& x);
|
106 |
|
|
friend std::ostream& operator <<(std::ostream& ostr, const Matrice& obj);
|
107 |
|
|
vecteur Multiply (const vecteur&);
|
108 |
|
|
Matrice Get_Inverse(Matrice& K);
|
109 |
|
|
void affiche();
|
110 |
|
|
friend vecteur operator * (const Matrice&,const vecteur&);
|
111 |
souaissa |
108 |
// void convert_Mat(const Matrice&,double,MatCr&);
|
112 |
|
|
|
113 |
|
|
};
|
114 |
|
|
|
115 |
|
|
|
116 |
souaissa |
161 |
DLLPORTSOLVEUR vecteur operator * (const Matrice&,const vecteur&);
|
117 |
souaissa |
108 |
DLLPORTSOLVEUR std::ostream& operator <<(std::ostream& ostr, const Matrice& obj);
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
#endif
|
121 |
|
|
|
122 |
|
|
|