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

📄 zdrive.c

📁 SuperLU is a general purpose library for the direct solution of large, sparse, nonsymmetric systems
💻 C
📖 第 1 页 / 共 2 页
字号:
			    zgsequ(&A, R, C, &rowcnd, &colcnd, &amax, &info);			    /* Force equilibration. */			    if ( !info && n > 0 ) {				if ( lsame_(equed, "R") ) {				    rowcnd = 0.;				    colcnd = 1.;				} else if ( lsame_(equed, "C") ) {				    rowcnd = 1.;				    colcnd = 0.;				} else if ( lsame_(equed, "B") ) {				    rowcnd = 0.;				    colcnd = 0.;				}			    }						    /* Equilibrate the matrix. */			    zlaqgs(&A, R, C, rowcnd, colcnd, amax, equed);			}		    }		    		    if ( prefact ) { /* Need a factor for the first time */					        /* Save Fact option. */		        fact = options.Fact;			options.Fact = DOFACT;			/* Preorder the matrix, obtain the column etree. */			sp_preorder(&options, &A, perm_c, etree, &AC);			/* Factor the matrix AC. */			zgstrf(&options, &AC, drop_tol, relax, panel_size,                               etree, work, lwork, perm_c, perm_r, &L, &U,                               &stat, &info);			if ( info ) {                             printf("** First factor: info %d, equed %c\n",				   info, *equed);                            if ( lwork == -1 ) {                                printf("** Estimated memory: %d bytes\n",                                        info - n);                                exit(0);                            }                        }	                        Destroy_CompCol_Permuted(&AC);					        /* Restore Fact option. */			options.Fact = fact;		    } /* if .. first time factor */		    		    for (itran = 0; itran < NTRAN; ++itran) {			trans = transs[itran];                        options.Trans = trans;			/* Restore the matrix A. */			zCopy_CompCol_Matrix(&ASAV, &A);			 			/* Set the right hand side. */			zFillRHS(trans, nrhs, xact, ldx, &A, &B);			zCopy_Dense_Matrix(m, nrhs, rhsb, ldb, bsav, ldb);			/*----------------			 * Test zgssv			 *----------------*/			if ( options.Fact == DOFACT && itran == 0) {                            /* Not yet factored, and untransposed */				    zCopy_Dense_Matrix(m, nrhs, rhsb, ldb, solx, ldx);			    zgssv(&options, &A, perm_c, perm_r, &L, &U, &X,                                  &stat, &info);			    			    if ( info && info != izero ) {                                printf(FMT3, "zgssv",				       info, izero, n, nrhs, imat, nfail);			    } else {                                /* Reconstruct matrix from factors and	                           compute residual. */                                zgst01(m, n, &A, &L, &U, perm_c, perm_r,                                         &result[0]);				nt = 1;				if ( izero == 0 ) {				    /* Compute residual of the computed				       solution. */				    zCopy_Dense_Matrix(m, nrhs, rhsb, ldb,						       wwork, ldb);				    zgst02(trans, m, n, nrhs, &A, solx,                                              ldx, wwork,ldb, &result[1]);				    nt = 2;				}								/* Print information about the tests that				   did not pass the threshold.      */				for (i = 0; i < nt; ++i) {				    if ( result[i] >= THRESH ) {					printf(FMT1, "zgssv", n, i,					       result[i]);					++nfail;				    }				}				nrun += nt;			    } /* else .. info == 0 */			    /* Restore perm_c. */			    for (i = 0; i < n; ++i) perm_c[i] = pc_save[i];		            if (lwork == 0) {			        Destroy_SuperNode_Matrix(&L);			        Destroy_CompCol_Matrix(&U);			    }			} /* if .. end of testing zgssv */    			/*----------------			 * Test zgssvx			 *----------------*/    			/* Equilibrate the matrix if fact = FACTORED and			   equed = 'R', 'C', or 'B'.   */			if ( options.Fact == FACTORED &&			     (equil || iequed) && n > 0 ) {			    zlaqgs(&A, R, C, rowcnd, colcnd, amax, equed);			}						/* Solve the system and compute the condition number			   and error bounds using zgssvx.      */			zgssvx(&options, &A, perm_c, perm_r, etree,                               equed, R, C, &L, &U, work, lwork, &B, &X, &rpg,                               &rcond, ferr, berr, &mem_usage, &stat, &info);			if ( info && info != izero ) {			    printf(FMT3, "zgssvx",				   info, izero, n, nrhs, imat, nfail);                            if ( lwork == -1 ) {                                printf("** Estimated memory: %.0f bytes\n",                                        mem_usage.total_needed);                                exit(0);                            }			} else {			    if ( !prefact ) {			    	/* Reconstruct matrix from factors and	 			   compute residual. */                                zgst01(m, n, &A, &L, &U, perm_c, perm_r,                                         &result[0]);				k1 = 0;			    } else {			   	k1 = 1;			    }			    if ( !info ) {				/* Compute residual of the computed solution.*/				zCopy_Dense_Matrix(m, nrhs, bsav, ldb,						  wwork, ldb);				zgst02(trans, m, n, nrhs, &ASAV, solx, ldx,					  wwork, ldb, &result[1]);				/* Check solution from generated exact				   solution. */				zgst04(n, nrhs, solx, ldx, xact, ldx, rcond,					  &result[2]);				/* Check the error bounds from iterative				   refinement. */				zgst07(trans, n, nrhs, &ASAV, bsav, ldb,					  solx, ldx, xact, ldx, ferr, berr,					  &result[3]);				/* Print information about the tests that did				   not pass the threshold.    */				for (i = k1; i < NTESTS; ++i) {				    if ( result[i] >= THRESH ) {					printf(FMT2, "zgssvx",					       options.Fact, trans, *equed,					       n, imat, i, result[i]);					++nfail;				    }				}				nrun += NTESTS;			    } /* if .. info == 0 */			} /* else .. end of testing zgssvx */		    } /* for itran ... */		    if ( lwork == 0 ) {			Destroy_SuperNode_Matrix(&L);			Destroy_CompCol_Matrix(&U);		    }		} /* for equil ... */	    } /* for ifact ... */	} /* for iequed ... */#if 0        if ( !info ) {	PrintPerf(&L, &U, &mem_usage, rpg, rcond, ferr, berr, equed);    }#endif        } /* for imat ... */    /* Print a summary of the results. */    PrintSumm("ZGE", nfail, nrun, nerrs);    SUPERLU_FREE (rhsb);    SUPERLU_FREE (bsav);    SUPERLU_FREE (solx);        SUPERLU_FREE (xact);    SUPERLU_FREE (etree);    SUPERLU_FREE (perm_r);    SUPERLU_FREE (perm_c);    SUPERLU_FREE (pc_save);    SUPERLU_FREE (R);    SUPERLU_FREE (C);    SUPERLU_FREE (ferr);    SUPERLU_FREE (berr);    SUPERLU_FREE (rwork);    SUPERLU_FREE (wwork);    Destroy_SuperMatrix_Store(&B);    Destroy_SuperMatrix_Store(&X);    Destroy_CompCol_Matrix(&A);    Destroy_CompCol_Matrix(&ASAV);    if ( lwork > 0 ) {	SUPERLU_FREE (work);	Destroy_SuperMatrix_Store(&L);	Destroy_SuperMatrix_Store(&U);    }    StatFree(&stat);    return 0;}/*   * Parse command line options to get relaxed snode size, panel size, etc. */static voidparse_command_line(int argc, char *argv[], char *matrix_type,		   int *n, int *w, int *relax, int *nrhs, int *maxsuper,		   int *rowblk, int *colblk, int *lwork, double *u){    int c;    extern char *optarg;    while ( (c = getopt(argc, argv, "ht:n:w:r:s:m:b:c:l:")) != EOF ) {	switch (c) {	  case 'h':	    printf("Options:\n");	    printf("\t-w <int> - panel size\n");	    printf("\t-r <int> - granularity of relaxed supernodes\n");	    exit(1);	    break;	  case 't': strcpy(matrix_type, optarg);	            break;	  case 'n': *n = atoi(optarg);	            break;	  case 'w': *w = atoi(optarg);	            break;	  case 'r': *relax = atoi(optarg); 	            break;	  case 's': *nrhs = atoi(optarg); 	            break;	  case 'm': *maxsuper = atoi(optarg); 	            break;	  case 'b': *rowblk = atoi(optarg); 	            break;	  case 'c': *colblk = atoi(optarg); 	            break;	  case 'l': *lwork = atoi(optarg); 	            break;	  case 'u': *u = atof(optarg); 	            break;  	}    }}

⌨️ 快捷键说明

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