spars.h
来自「一个2D电磁场FEM计算的VC++源程序」· C头文件 代码 · 共 119 行
H
119 行
class CEntry
{
public:
double x; // value stored in the entry
int c; // column that the entry lives in
CEntry *next; // pointer to next entry in row;
CEntry();
private:
};
class CBigLinProb
{
public:
// data members
double *V; // solution
double *P; // search direction;
double *R; // residual;
double *U; // A * P;
double *Z;
double *b; // RHS of linear equation
CEntry **M; // pointer to list of matrix entries;
int n; // dimensions of the matrix;
int bdw; // Optional matrix bandwidth parameter;
double Lambda; // relaxation factor;
double Precision; // error tolerance for solution
// member functions
CBigLinProb(); // constructor
~CBigLinProb(); // destructor
int Create(int d, int bw); // initialize the problem
void Put(double v, int p, int q);
// use to create/set entries in the matrix
double Get(int p, int q);
int PCGSolve(int flag); // flag==true if guess for V present;
void MultPC(double *X, double *Y);
void MultA(double *X, double *Y);
void SetValue(int i, double x);
void Periodicity(int i, int j);
void AntiPeriodicity(int i, int j);
void Wipe();
double Dot(double *X, double *Y);
CFknDlg *TheView;
private:
};
/////////////////////////////////////////////////////////////////////
// for complex matrices......
class CComplexEntry
{
public:
CComplex x; // value stored in the entry
int c; // column that the entry lives in
CComplexEntry *next; // pointer to next entry in the row;
CComplexEntry();
private:
};
class CBigComplexLinProb
{
public:
// data members
CComplex *P;
CComplex *U;
CComplex *R;
CComplex *V;
CComplex *Z;
CComplex *b; // RHS of linear equation
CComplexEntry **M; // pointer to list of matrix entries;
int n; // dimensions of the matrix;
int bdw; // optional bandwidth parameter;
int NumNodes;
double Precision;
CComplex Lambda;
// member functions
CBigComplexLinProb(); // constructor
~CBigComplexLinProb(); // destructor
int Create(int d, int bw, int nodes); // initialize the problem
void Put(CComplex v, int p, int q);
// use to create/set entries in the matrix
CComplex Get(int p, int q);
int PBCGSolve(int flag); // flag==true if guess for V present;
int QMRSolve(int flag);
void MultA(CComplex *X, CComplex *Y);
void MultConjA(CComplex *X, CComplex *Y);
CComplex Dot(CComplex *x, CComplex *y);
CComplex ConjDot(CComplex *x, CComplex *y);
void SetValue(int i, CComplex x);
void Periodicity(int i, int j);
void AntiPeriodicity(int i, int j);
void Wipe();
void MultPC(CComplex *X, CComplex *Y);
void MultAPPA(CComplex *X, CComplex *Y);
int PCGSQSolve(int flag);
int PCGSQStart(int flag);
int PBCGSolveMod(int flag);
CFknDlg *TheView;
private:
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?