⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmatrix.h

📁 矩阵运算库
💻 H
字号:
// JMatrix.h: interface for the JMatrix class.
//
//	Lu Ying Jie
//	DV Lab
//
//	date notes:
//		1th edition : 2001.5
//		2th edition : 2002.7
//		3th edition : 2003.1
//
//
//////////////////////////////////////////////////////////////////////


#if !defined(AFX_JMATRIX_H__C19BCFE3_D35E_4B5D_87E3_5CE922C1E0EA__INCLUDED_)
#define AFX_JMATRIX_H__C19BCFE3_D35E_4B5D_87E3_5CE922C1E0EA__INCLUDED_




class JMatrix
{
private:

	unsigned int	row, col ;											//  number of rows and columns

	double			* data ;											//  pointer to the matrix's data


public:

	JMatrix( unsigned int ROW=1, unsigned int COL=1 ) ;

	JMatrix( const JMatrix & A ) ;

	~JMatrix() ;


public:

	unsigned int	DimRow( ) const ;									//  query

	unsigned int	DimCol( ) const ;									//  query


public:

	double			operator () ( unsigned int ROW, unsigned int COL ) const ;
																		//  read only		T[ROW][COL]

	double *		operator [] ( unsigned int ROW ) ;					//  read & write	T[ROW]


	const JMatrix	operator +  ( double v ) const ;					//	T + v

	const JMatrix	operator -  ( double v ) const ;					//	T - v

	const JMatrix	operator *  ( double v ) const ;					//	T * v

	const JMatrix	operator +  ( const JMatrix & A ) const ;			//  T + A

	const JMatrix	operator -  ( const JMatrix & A ) const ;			//  T - A

	const JMatrix	operator *  ( const JMatrix & A ) const ;			//  T * A


	JMatrix &		operator =  ( const JMatrix & A ) ;					//  T = A


	JMatrix &		operator += ( double v ) ;							//  T = T + v

	JMatrix &		operator -= ( double v ) ;							//  T = T - v

	JMatrix &		operator *= ( double v ) ;							//  T = T * v

	JMatrix &		operator += ( const JMatrix & A ) ;					//  T = T + A

	JMatrix &		operator -= ( const JMatrix & A ) ;					//  T = T - A


public:

	JMatrix &		Transpose() ;

	JMatrix &		Inverse( double tol=0 ) ;

	JMatrix &		Zero() ;


	JMatrix &		EqAdd( const JMatrix & A, const JMatrix & B ) ;		//  T = A + B

	JMatrix &		EqSub( const JMatrix & A, const JMatrix & B ) ;		//  T = A - B

	JMatrix &		EqMul( const JMatrix & A, const JMatrix & B ) ;		//  T = A * B


	double			NormF() const ;

	double			Norm1() const ;

	double			NormInf() const ;


	int				LinSol( JMatrix & B, double tol=0 ) ;				//  solve linear equation:	A * X = B

};


#endif // !defined(AFX_JMATRIX_H__C19BCFE3_D35E_4B5D_87E3_5CE922C1E0EA__INCLUDED_)

⌨️ 快捷键说明

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