logplus/BaseFun/include/LEquations.h
2025-10-29 17:23:30 +08:00

90 lines
3.1 KiB
C++

//////////////////////////////////////////////////////////////////////
// LEquations.h
//
// 求解线性方程组的类 CLEquations 的声明接口
//
// 编制, 2002/8
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LEQUATIONS_H__89A63160_719C_440D_9DFC_953F79BD4C4D__INCLUDED_)
#define AFX_LEQUATIONS_H__89A63160_719C_440D_9DFC_953F79BD4C4D__INCLUDED_
#include "BaseFun.h"
// 需要调用矩阵操作类
#include "Matrix1.h"
// 类声明
class BASEFUN_EXPORT CLEquations
{
//
// 公有接口函数
//
public:
//
// 构造与析构
//
CLEquations(); // 默认构造函数
// 指定系数和常数构造函数
CLEquations(const CMatrix1& mtxCoef, const CMatrix1& mtxConst);
virtual ~CLEquations(); // 析构函数
// 初始化
BOOL Init(const CMatrix1& mtxCoef, const CMatrix1& mtxConst);
//
// 属性
//
CMatrix1 GetCoefMatrix() const; // 获取系数矩阵
CMatrix1 GetConstMatrix() const; // 获取常数矩阵
int GetNumEquations() const; // 获取方程个数
int GetNumUnknowns() const; // 获取未知数个数
//
// 线性方程组求解算法
//
// 全选主元高斯消去法
BOOL GetRootsetGauss(CMatrix1& mtxResult);
// 全选主元高斯-约当消去法
BOOL GetRootsetGaussJordan(CMatrix1& mtxResult);
// 复系数方程组的全选主元高斯消去法
BOOL GetRootsetGauss(const CMatrix1& mtxCoefImag, const CMatrix1& mtxConstImag, CMatrix1& mtxResult, CMatrix1& mtxResultImag);
// 复系数方程组的全选主元高斯-约当消去法
BOOL GetRootsetGaussJordan(const CMatrix1& mtxCoefImag, const CMatrix1& mtxConstImag, CMatrix1& mtxResult, CMatrix1& mtxResultImag);
// 求解三对角线方程组的追赶法
BOOL GetRootsetTriDiagonal(CMatrix1& mtxResult);
// 一般带型方程组的求解
BOOL GetRootsetBand(int nBandWidth, CMatrix1& mtxResult);
// 求解对称方程组的分解法
BOOL GetRootsetDjn(CMatrix1& mtxResult);
// 求解对称正定方程组的平方根法
BOOL GetRootsetCholesky(CMatrix1& mtxResult);
// 求解大型稀疏方程组的全选主元高斯-约去消去法
BOOL GetRootsetGgje(CMatrix1& mtxResult);
// 求解托伯利兹方程组的列文逊方法
BOOL GetRootsetTlvs(CMatrix1& mtxResult);
// 高斯-赛德尔迭代法
BOOL GetRootsetGaussSeidel(CMatrix1& mtxResult, float eps = 0.000001);
// 求解对称正定方程组的共轭梯度法
void GetRootsetGrad(CMatrix1& mtxResult, float eps = 0.000001);
// 求解线性最小二乘问题的豪斯荷尔德变换法
BOOL GetRootsetMqr(CMatrix1& mtxResult, CMatrix1& mtxQ, CMatrix1& mtxR);
// 求解线性最小二乘问题的广义逆法
BOOL GetRootsetGinv(CMatrix1& mtxResult, CMatrix1& mtxAP, CMatrix1& mtxU, CMatrix1& mtxV, float eps = 0.000001);
// 病态方程组的求解
BOOL GetRootsetMorbid(CMatrix1& mtxResult, int nMaxIt = 60, float eps = 0.000001);
// complex<float> waveseparate( float s[int p],float d,complex<float> w[N],int N,int n);
//
// 保护性数据成员
//
protected:
CMatrix1 m_mtxCoef; // 系数矩阵
CMatrix1 m_mtxConst; // 常数矩阵
};
#endif // !defined(AFX_LEQUATIONS_H__89A63160_719C_440D_9DFC_953F79BD4C4D__INCLUDED_)