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

📄 linsys.h

📁 斯坦福Energy211/CME211课《c++编程——地球科学科学家和工程师》的课件
💻 H
字号:
#ifndef CLASS_LINSYS#define CLASS_LINSYS#include "vector.h"class LinearSystem {public:	enum IterMethod {		MethodJacobi,		MethodGaussSeidel,		MethodSOR	} ;	enum ErrorCode {		ERROR_MATRIX_SINGULAR,		ERROR_MATRIX_NOT_SQUARE,		ERROR_SIZE_MISMATCH	} ;		LinearSystem( const Matrix& A )	{		m_A = A;		m_Factored = false;	}	LinearSystem( const LinearSystem& S );	~LinearSystem()	{	}	ColVector DirectSolve( const ColVector& b );	ColVector IterativeSolve( const ColVector& b, IterMethod m, double w = 1.0 );			void SetMaxIter( int n ) { m_maxiter = n; }	void SetTol( double tol ) { m_tol = tol; }private:	Matrix m_A;	Matrix m_L;	Matrix m_U;	bool m_Factored;	int m_maxiter;	double m_tol;	void GaussElim();	ColVector ForwardSub( const Matrix& L, const ColVector& b );	ColVector BackSub( const Matrix& U, const ColVector& y );	ColVector StationarySolve( const Matrix& M, const Matrix& N, const ColVector& b );	ColVector Jacobi( const ColVector& b );	ColVector GaussSeidel( const ColVector& b );	ColVector SOR( const ColVector& b, double w );		// Leave these alone!  They are used for error reporting	static void ReportError( ErrorCode errorcode );	static char *ErrorMessages[];} ;#endif // CLASS_LINSYS

⌨️ 快捷键说明

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