complexmatrix.h

来自「这是一个复数矩阵计算的源代码」· C头文件 代码 · 共 63 行

H
63
字号
// ComplexMatrix.h: interface for the CComplexMatrix class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(__COMPLEXMATRIX_H__)
#define __COMPLEXMATRIX_H__

#include <complex>
using namespace std;
typedef complex<double> Complex;

class CComplexMatrix 
{
protected:
	struct CNode
	{
		int nRow;
		int nCol;
		CNode *pRight;
		CNode *pDown;
		CNode *pPrev;
		CNode *pNext;
		Complex data;
	};

	CNode *pHead;
	CNode *pTail;
	CNode *pCurrent;
	CNode *pData;

	void Copy(const CComplexMatrix &src);

public:
	CComplexMatrix();
	void Create(int row,int col);
	virtual ~CComplexMatrix();

	void Store(int row,int col,const Complex newElement);
	void Add(int row,int col,const Complex newElement);
	void GetData(int &row,int &col,Complex &data);

	void GoToHead();
	void GoToTail();
	void GoNext();
	void GoPrev();
	void GoRight();
	void GoDown();

	BOOL IsEmpty();
	void Empty();

	CComplexMatrix operator +(const CComplexMatrix &src);
	CComplexMatrix operator -(const CComplexMatrix &src);
	CComplexMatrix operator *(const CComplexMatrix &src);
	CComplexMatrix operator -();
	void operator =(const CComplexMatrix &src);
	void operator +=(const CComplexMatrix &src);
	void operator -=(const CComplexMatrix &src);
	void operator *=(const CComplexMatrix &src);
	CComplexMatrix Transpose();
};

#endif // !defined(__COMPLEXMATRIX_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?