📄 matrix.h
字号:
// Matrix.h: interface for the CMatrix class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MATRIX_H__1D4A689F_CE10_42D0_95E8_9EC16E68ED32__INCLUDED_)
#define AFX_MATRIX_H__1D4A689F_CE10_42D0_95E8_9EC16E68ED32__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define TINY 1.0e-20
//矩阵类,用于矩阵的运算
class CMatrix
{
public:
double **m_mat;//矩阵指针
int m_row,m_col;//矩阵的行列
CMatrix(int);//重载构造函数
CMatrix(int,int);//重载构造函数
CMatrix (const CMatrix &);//显式复制构造函数
void SetSize(int);
void SetSize(int,int);
virtual ~CMatrix();//析构函数
//操作符重载
CMatrix& operator =(CMatrix &);//矩阵赋值
CMatrix operator +(CMatrix &);//矩阵加法
CMatrix operator -(CMatrix &);//矩阵减法
CMatrix operator *(CMatrix &);//矩阵乘法
CMatrix operator !();//矩阵求逆
CMatrix operator ~();//矩阵转置
double& operator ()(int,int);//取矩阵元素
CMatrix operator *(double);//矩阵与数相乘
friend CMatrix operator *(double d , CMatrix& m){return m*d;}//数与矩阵相乘
void Display();//矩阵显示
//Dolittle分解求矩阵逆
protected:
void MatInverse(double** mat,int dim);
void MatLudcmp(double** mat, int, int*, double*);
void MatLubksb(double** mat, int, int*, double*);
};
#endif // !defined(AFX_MATRIX_H__1D4A689F_CE10_42D0_95E8_9EC16E68ED32__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -