📄 matrix.h
字号:
#ifndef _Matrix_h_DEFINED
#define _Matrix_h_DEFINED
class Matrix
{
public:
int M; // number of rows
int N; // number of columns
double* X; // matrix pointer
int getm() const; // return number of rows
int getn() const; // return number of columns
double* getx() const; // return pointer to array
// Constructors
Matrix();
Matrix(int m, int n, bool I=false);
~Matrix();
Matrix(const Matrix& a);
Matrix transp(); // Matrix Transpose
Matrix& operator = (const Matrix& a); // Overloaded Operator
double* operator [] (int i) const; // Overloaded Operator
};
// Overloaded Operators
Matrix operator + (const Matrix& a, const Matrix& b);
Matrix operator - (const Matrix& a, const Matrix& b);
Matrix operator * (const Matrix& a, const Matrix& b);
Matrix operator * (const double& a, const Matrix& b);
Matrix operator * (const Matrix& a, const double& b);
Matrix operator / (const Matrix& a, const double& b);
// 2x2 Matrix Inversion
Matrix Invert22(const Matrix& a);
inline double convDble(const Matrix& a) { return a[0][0]; } // Convert 1x1 matrix to Double
inline int Matrix::getm() const { return M; }
inline int Matrix::getn() const { return N; }
inline double* Matrix::getx() const { return X; }
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -