-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mat.hpp
65 lines (32 loc) · 1.16 KB
/
Mat.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef MAT_HPP
#define MAT_HPP
#include <vector>
#include <iostream>
using namespace std;
class Mat {
friend void MvProd(const Mat& A, const vector<double>& x, vector<double>& b);
friend void MMProd(const Mat& A, const Mat& B, Mat& C);
friend ostream& operator<< (ostream& os, const Mat& M);
friend void Solve(const Mat& A, vector<double>& x, const vector<double>& b);
friend void NormalSolve(const Mat& A, vector<double>& x, const vector<double>& b);
friend void GramSchmidtSolve(const Mat& A, vector<double>& x, const vector<double>& b);
friend void HouseholderSolve(const Mat& A, vector<double>& x, const vector<double>& b);
private :
int m_NbRow;
int m_NbCol;
vector<double> m_val;
public :
Mat(const int& nr = 0, const int& nc = 0);
Mat(const vector<double>& val, const int nr, const int nc);
Mat(const Mat& M);
int Col() const;
int Row() const;
void Col(vector<double>& v, int i);
void Row(vector<double>& v, int i);
void resize(int nr, int nc);
double operator() (int i, int j) const;
double& operator() (int i, int j);
Mat & operator= (const Mat& M);
void Load (char* const filename);
};
#endif