?? matrix.h
字號:
// Matrix.h: interface for the CMatrix class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MATRIX_H__BF29AB98_8F8D_4BBC_8171_4ADD41EE27F9__INCLUDED_)
#define AFX_MATRIX_H__BF29AB98_8F8D_4BBC_8171_4ADD41EE27F9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMatrix//矩陣基本功能實現類
{
public:
int Initate(int iRowNum, int iLineNum);
double GetElement(int iRow, int iLine);
void CreateData(double *a,int m,int n);//數據的輸入
void transpose();//矩陣轉置
void DisplayMatrix();//顯示矩陣
bool ChangeLine(int m, int n);//換列
bool ChangeRow(int m,int n);//換行
bool InsertLine(int *m,double *a,int n,int t);//m[]必須按升序排列,在矩陣第m[i]列中加一列a[][i],原先的該列往左移,n為a[][]的行數,t為a[][]的列數
bool InsertRow(int *m,double *a,int n,int t);//m[]必須按升序排列,在矩陣第m[i]行中加一行a[i][],原先的該行往下移,n為a[][]的行數,t為a[][]的列數
//////////////////////////////////////////////////////////////////////////
int GetRow();//獲得行數
int GetLine();//獲得列數
double* GetData();//獲得矩陣數據
double GetMatrixValue();//求矩陣行列式的值
CMatrix GetConvertMatrix();//求矩陣的逆矩陣
CMatrix GetConvertMatrix(int iBool);
int InversMatrix(double* pm1, int i4n)const;
///////////////////////////////////////////////////運算符重載
CMatrix operator*(const CMatrix &multiplier);
CMatrix operator-(const CMatrix &m1);
CMatrix operator+(const CMatrix &m1);
CMatrix operator= (const CMatrix &s);
// CMatrix& operator = (const CMatrix &s);//直接應用引用降低對大矩陣的復制
//////////////////////////////////////////////////////////////////////////
virtual ~CMatrix();
CMatrix();
CMatrix(int r,int l,bool f=false,double *a=NULL);//r為矩陣的行,l為矩陣的列,f用于確定是否要自己輸入,如果為假則初始化為0.
CMatrix (CMatrix &s);//拷貝構造函數
//矩陣的屬性
private:
int m_Row,m_Line;//矩陣的行數和列數
double *m_Data;//矩陣的元素
};
#endif // !defined(AFX_MATRIX_H__BF29AB98_8F8D_4BBC_8171_4ADD41EE27F9__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -