matrix.h
来自「该文件是包含了机器人足球比赛中的整个系统的代码」· C头文件 代码 · 共 45 行
H
45 行
#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 + =
减小字号Ctrl + -
显示快捷键?