# 用sparselib库解稀疏矩阵线性方程组

GMRES(A,B,RESTART,TOL,MAXIT)；

 #include #include #include "compcol_double.h"#include "mvvtp.h"#include "mvblasd.h"#include "ilupre_double.h"#include "gmres.h"#include "spblas.h"#include "mvm.h"//#include MATRIX_H//using namespace std; int main(void){   double val[] = {10, 3, 3, 9, 7, 8, 4, 9, 8, 7, 7, 9, -2, 5, 9, 2, 3, 13, -1};   int row_ind[] = {0, 1, 3, 1, 2, 4, 5, 2, 3, 2, 3, 4,  0, 3, 4, 5, 1, 4,  5};   int col_ptr[] = {0, 3, 7, 9, 12, 16, 19};    int maxit = 150;                     // maximum iteration   int nUnknown = 6;                    // unknown, the size of Jacobi   int nNonZero = 19;                   // nonZero values in the matrix   int results;   int restart = 10;                    // restart iterations   double tol = 1.e-6;                  // convergence tolerance    CompCol_Mat_double  Jacobi(nUnknown, nUnknown, nNonZero, val, row_ind, col_ptr);   //cout << Jacobi;   CompCol_ILUPreconditioner_double M(Jacobi); // construct preconditioner    MATRIX_double H(restart+1, restart, 0.0);   // storage for upper Hessenberg H;   VECTOR_double xi(nUnknown, 0);   VECTOR_double rhs(nUnknown);    for(int i=0; i

xi[0]=  0.248096
xi[1]=  0.705373
xi[2]=-1.49092
xi[3]= 1.64009
xi[4]= 0.740481
xi[5]=-1.69755

10     0     0     0    -2     0
3     9     0     0     0     3
0     7     9     7     0     0
3     0     8     7     5     0
0     8     0     9     9    13
0     4     0     0     2    -1

I.S. Duff,R.G.Grimes,and J.G.Lewis,Sparse matrix test problems,ACM Trans.Math.Soft

• 本文已收录于以下专栏：

举报原因： 您举报文章：用sparselib库解稀疏矩阵线性方程组 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)