📄 cdmatrix.h
字号:
/* CDMatrix类声明*/
#ifndef DMATRIX
#define DMATRIX
#include "Head.h"
class CDMatrix
{
// 接口函数
public:
// 缺省构造函数
CDMatrix();
// 方阵构造函数
CDMatrix(int nSize);
// 拷贝构造函数
CDMatrix(const CDMatrix& other);
// 析构函数
virtual ~CDMatrix();
// 成员函数
// 初始化矩阵
bool Init(int nSize);
// 设置指定元素的值
bool SetElement(int nRow, int nCol, double value);
// 设置矩阵的值
void SetData(double value[]);
// 获取指定元素的值
double GetElement(int nRow, int nCol) const;
// 获取矩阵的行数
int GetSize() const;
// 获取矩阵的值
double* GetData() const;
// 获得矩阵中的子块
CMatrix GetPartK(
int nRowStart,
int nRowNum,
int nColStart,
int nColNum );
// 运算符重载
CDMatrix& operator=(const CDMatrix& other);
// 从文件中读取一个矩阵
bool CDMatrix::Read( ifstream &readfile);
// 写入一个矩阵到文件中
bool Write( ofstream &writefile);
// 保护性数据成员
protected:
// 矩阵行数
int m_nSize;
// 矩阵数据
double* p_Data;
// 内部函数
private:
//
};
#endif // CDMATRIX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -