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