?? matrix.h
字號:
#if !defined(AFX_MATRIX_H__3E289FE1_35F9_439B_B0FD_0553A00287F2__INCLUDED_)
#define AFX_MATRIX_H__3E289FE1_35F9_439B_B0FD_0553A00287F2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "iostream.h"
// Matrix.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMatrix document
class CMatrix : public CDocument
{
protected:
// protected constructor used by dynamic creation
DECLARE_DYNCREATE(CMatrix)
// Attributes
private:
double * p;
//矩陣寬度
long width;
//矩陣高度
long height;
// Operations
public:
long getHeight();
long getWidth();
CMatrix T();//轉置
double order();//求秩
bool isPtv();//是否正定
CMatrix rever();//求逆陣
double Arg();//求行列式的值
bool isVector();//如果是false,那就是一個數
CMatrix GetTrian();//獲得上三角形陣,用選行主元消去法
CMatrix GetTopTrian();//獲得上三角形陣,用順序削去法
CMatrix GetBotTrian();//獲得下三角形陣,用順序削去法(未討論0的情況)
long findMainElem(long height,long width);//選主元,返回值為主元所在行
void exchangeRow(long i,long j);//用于交換第i行和第j行
CMatrix addMatrix(CMatrix &,bool);//實現增廣矩陣,bool為1則為(A,b)形式,為0為列向量
CMatrix subCMatrix(long offset);
void Test();//測試函數
/***********重載部分-Overloaded Part*****************/
CMatrix operator+(CMatrix &);
CMatrix operator-(CMatrix &);
CMatrix operator-();//負號重載
CMatrix operator*(CMatrix &);
friend CMatrix operator*(double alpha,CMatrix &);//實數與矩陣相乘
CMatrix operator*(double alpha);//矩陣與實數相乘
CMatrix operator/(CMatrix &);//實際是實數相除或矩陣和實數相除
CMatrix operator/(double sub);
CMatrix operator+=(CMatrix &);
CMatrix operator-=(CMatrix &);
CMatrix operator*=(double alpha);//矩陣與實數相乘
friend CMatrix sqrt(CMatrix m);//開方
friend double abs(CMatrix &);//取絕對值
CMatrix &operator=(CMatrix &);
double * operator[](long heightPos);//用于實現用[][]操作矩陣元素
friend ostream & operator<<(ostream &,CMatrix &);
CMatrix(void);//default constructor
CMatrix(long n);//單位矩陣
CMatrix(double * arrAddress,long arrWidth);//構造一維矩陣
CMatrix(double * arrAddress,long arrHeight,long arrWidth);
CMatrix(const CMatrix &);//copy constructor
~CMatrix(void);//default destructor
/***********重載部分-Overloaded Part*****************/
// Overrides
// CMatrixWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMatrix)
public:
virtual void Serialize(CArchive& ar); // overridden for document i/o
protected:
virtual BOOL OnNewDocument();
//}}AFX_VIRTUAL
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CMatrix)
// NOTE - the CMatrixWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MATRIX_H__3E289FE1_35F9_439B_B0FD_0553A00287F2__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -