-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.hpp
More file actions
43 lines (34 loc) · 1.21 KB
/
Matrix.hpp
File metadata and controls
43 lines (34 loc) · 1.21 KB
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
#ifndef _MATRIX_HPP_
#define _MATRIX_HPP_
template<typename T>
class Matrix {
unsigned int row; // 行
unsigned int col; // 列
T *data;
public:
Matrix();
Matrix(unsigned int rows, unsigned int cols);
Matrix(unsigned int rows, unsigned int cols, const T init_num);
~Matrix();
unsigned int row_size() const { return row; }
unsigned int col_size() const { return col; }
T& operator()(unsigned int r, unsigned int c);
const T& operator()(unsigned int r, unsigned int c) const;
Matrix<T>& operator=(const Matrix<T>& other);
Matrix<T>& operator+=(const Matrix<T>& other);
Matrix<T>& operator-=(const Matrix<T>& other);
Matrix<T>& operator*=(const T other);
Matrix<T>& operator*=(const Matrix<T>& other);
Matrix<T> operator+(const Matrix<T>& other) const;
Matrix<T> operator-(const Matrix<T>& other) const;
Matrix<T> operator*(const T other) const;
Matrix<T> operator*(const Matrix<T>& other) const;
Matrix<T> operator%(const T mod);
T determinant();
Matrix<T> transpose();
Matrix<T> inverse();
bool is_identity_matrix();
bool is_zero_matrix();
};
#include "Matrix.cpp"
#endif // _MATRIX_HPP_