arraymatrix.h

来自「实现常用的矩阵运算」· C头文件 代码 · 共 62 行

H
62
字号
// ArrayMatrix.h: interface for the CArrayMatrix class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ARRAYMATRIX_H__75314E61_4BBF_11D5_9DFE_5254AB1C303A__INCLUDED_)
#define AFX_ARRAYMATRIX_H__75314E61_4BBF_11D5_9DFE_5254AB1C303A__INCLUDED_
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxtempl.h>
#include <string.h>


// CArrayMatrix command target

class CArrayMatrix : public CObject
{
public:
	CArrayMatrix();
	CArrayMatrix(UINT,UINT);
	CArrayMatrix(const CArrayMatrix &);
	CArrayMatrix(CString,UINT,UINT, double**);//动态申请二维数组的指针变量名
	CArrayMatrix(CString,UINT,UINT, float**);
	CArrayMatrix(UINT,UINT, double**);
        CArrayMatrix(UINT,UINT, float**);
	CArrayMatrix(UINT,UINT, double *);//例如::  double *=&data[0][0]  (data为二维时)  double*=data (data为一维时)  
	CArrayMatrix(UINT,UINT, float *);
	virtual ~CArrayMatrix();
	
	BOOL Initialize(UINT,UINT);//完成对矩阵的初始化
	BOOL SetName(CString m);//重置矩阵数据的名字
	CString GetName();//取矩阵数据的名字
	UINT GetRow();//取矩阵的行号
	UINT GetCol();//取矩阵的列号
	double GetData(UINT,UINT);//取[i][j]点的矩阵数据
	void   SetData(UINT,UINT,double);//重置点[i][j]点的数据
	CArrayMatrix GetAccompany()const;//求矩阵的伴随矩阵
	double GetRange()const;//求矩阵的行列式
	BOOL CanContrary()const;//是否可以求逆
	CArrayMatrix T()const;//求矩阵的转置矩阵
	CArrayMatrix operator ~();//高斯-约当法求实矩阵的逆矩阵
	CArrayMatrix operator /(CArrayMatrix & m);
	CArrayMatrix operator /(double m);
	CArrayMatrix operator *(const CArrayMatrix & m);
	CArrayMatrix operator *(double m);
	BOOL CanMutiply(const CArrayMatrix & m)const;
	BOOL CanAddSub(const CArrayMatrix & m)const;
	CArrayMatrix operator +(const CArrayMatrix & m);
	CArrayMatrix operator -(const CArrayMatrix & m);
	CArrayMatrix & operator =(const CArrayMatrix &m);
	CArrayMatrix & operator =(double m);
protected:
	CString m_Name;
	UINT m_wRow;
	UINT m_wCon;
	CArray<double,double &> m_Array;

};


⌨️ 快捷键说明

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