-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmatrix.h
61 lines (51 loc) · 1.71 KB
/
xmatrix.h
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
#ifndef XMATRIX_H
#define XMATRIX_H
#include <cmath>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
const double EPS = 1e-8;
class xMatrix {
public:
xMatrix();
xMatrix(int rows, int cols);
xMatrix(const xMatrix& o);
xMatrix(xMatrix&& o);
~xMatrix();
int GetRows() const;
int GetCols() const;
void SetRows(const int r);
void SetCols(const int c);
void Resize(const int r, const int c);
bool sEqMatrix(const xMatrix& other) const;
void SumMatrix(const xMatrix& other);
void SubMatrix(const xMatrix& other);
void MulNumber(const double num);
void MulMatrix(const xMatrix& other);
void LoadMatrixFromFile(const std::string& src);
xMatrix Transpose() const;
xMatrix CalcComplements() const;
double Determinant() const;
xMatrix InverseMatrix() const;
xMatrix operator-(const xMatrix& other) const;
xMatrix operator+(const xMatrix& other) const;
xMatrix operator*(const xMatrix& other) const;
xMatrix operator*(const double num) const;
friend xMatrix operator*(const double num, const xMatrix& mat);
bool operator==(const xMatrix& other);
xMatrix& operator=(const xMatrix& other);
xMatrix& operator+=(const xMatrix& other);
xMatrix& operator-=(const xMatrix& other);
xMatrix& operator*=(const xMatrix& other);
xMatrix& operator*=(const double num);
double& operator()(const int r, const int c);
void PrintMatrix();
private:
int rows_, cols_;
std::vector<std::vector<double>> matrix_;
std::vector<std::vector<double>> CreateMatrix(int r, int c);
void DeleteMatrix();
void MinorMatrix(xMatrix* minor, int using_row, int using_col) const;
};
#endif // XMATRIX_H