The SPARSELIB decomposition equation group is demonstrated below with Gmres (Generalized Minimum Residual Method). In matlab, you can use the following commands, Gmres (A, B, Restart, Tol, Maxit); you can do this in VC :
#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 // use 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 rot = {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 massage = 10; // restart ity t t t = 1.e-6; // conversTide 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