📄 symamggetparams.c
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <blas.h>#include <ilupack.h>#include <ilupackmacros.h>#define MAX_LINE 255#define STDERR stdout#define STDOUT stdout#define PRINT_INFO#define MAX(A,B) (((A)>(B))?(A):(B))#define MIN(A,B) (((A)<(B))?(A):(B))#define RESTOL_FUNC(A) sqrt(A)void SYMAMGGETPARAMS(ILUPACKPARAM param, integer *flags, REALS *elbow, REALS *droptols, REALS *condest, REALS *restol, integer *max_it){ /* extract some of the default parameters from ipar and fpar ipar integer parameters ipar[0,...,33] ipar[0] elbow space factor. Predict the fill-in required by the multilevel ILU by ipar[0]*nnz(A) default: 5 ipar[1] ipar[2] ipar[3] lfil parameter. Limit the number of nonzeros per column in L / row in U by ipar[3] default: n+1 ipar[4] flag that indicates different types of transposed systems Bit 0: A^T instead of A is stored Bit 1: CONJG(A) instead of A is stored Bit 2: solve A^Tx=b instead of Ax=b Bit 3: solve CONJG(A)x=b instead of Ax=b REMARK: Note that P is derived from A. So if A^T is stored instead of A, it follows that P^T is stored instead of P. Similar relations hold for CONJG(A) ipar[5] reserved for choice of iterative solver currently unused default: 1 ipar[6] flags for the configuration of the multilevel ILU available flags inverse based dropping: DROP_INVERSE don't shift away zero pivots(iluc): NO_SHIFT Tismentsky update: TISMENETSKY_SC repeated ILU(iluc): REPEAT_FACT improved estimate ||L^{-1}||,||U^{-1}||: IMPROVED_ESTIMATE diagonal compensation: DIAGONAL_COMPENSATION reduce the partial LU to non-coarse part(piluc,mpiluc): COARSE_REDUCE use different pivoting strategy, if the regular reordering fails: FINAL_PIVOTING initial system should be reordered using an initial strategy: PREPROCESS_INITIAL_SYSTEM subsequent systems should be reordered using the regular strategy: PREPROCESS_SUBSYSTEMS use mpiluc as template instead of piluc: MULTI_PILUC default: DROP_INVERSE |PREPROCESS_INITIAL_SYSTEM |PREPROCESS_SUBSYSTEMS |IMPROVED_ESTIMATE |FINAL_PIVOTING ipar[7] decide which kind of scaling should be combined with the three permutations Bit 0-2 initial preprocessing Bit 0 (no) left scaling 0/ 1 Bit 1 (no) right scaling 0/ 2 Bit 2 row/column scaling first 0/ 4 default: 3 Bit 3-5 regular reordering Bit 3 (no) left scaling 0/ 8 Bit 4 (no) right scaling 0/ 16 Bit 5 row/column scaling first 0/ 32 default: 24 Bit 6-8 final pivoting Bit 6 (no) left scaling 0/ 64 Bit 7 (no) right scaling 0/128 Bit 8 row/column scaling first 0/256 default: 192 Bit 9-10 indicate which ordering is currently in use 512 initial preprocessing 1024 regular reordering 1536 final pivoting default: 0 (no preference) sum default: 3+24+192 ipar[8] decide which kind of norm should be used with the three permutations Bit 0- 4 initial preprocessing 0 maximum norm 1 1-norm 2 2-norm 3 square root of the diagonal entries 4 weighted row norm? default: 3 Bit 5- 9 regular reordering 0 maximum norm 32*1 1-norm 32*2 2-norm 32*3 square root of the diagonal entries 32*4 weighted row norm? default: 32*3 Bit 10-14 final pivoting 0 maximum norm 1024*1 1-norm 1024*2 2-norm 1024*3 square root of the diagonal entries 1024*4 weighted row norm? default: 1024*3 sum default: 3+32*3+1024*3 ipar[9] lfil parameter for the approximate Schur complement. Limit the number of nonzeros per row in S by ipar[9] default: n+1 ipar[10] ipar[11] ipar[12] ipar[13,...,19] currently unused ipar[20,...33] parameters used by SPARSKIT solvers ipar[20] needed to init the iterative solver default: 0 ipar[21] preconditioning side (left 1, right 2, both 3) default: 2 ipar[22] stopping criteria default: 1 (relative residual) ipar[23] workspace size requested by SPARSKIT solver dependent on ipar[5]. Currently only GMRES is supported. defautl: (n+3)*(ipar[4]+2)+(ipar[4]+1)*ipar[4]/2; ipar[24] restart length for GMRES,FOM,... default: 30 ipar[25] maximum number of iteration steps default: MIN(1.1*n+10,500) ipar[26,...33] further parameters used by SPARSKIT solvers default: 0 fpar floating point parameters fpar[0] drop tolerance for triangular factors default: 1e-2 fpar[1] drop tolerance for the approximate Schur complement default: 1e-2 fpar[2] norm bound for the inverse triangular factors default: 1e+2 fpar[3] define when a matrix is dense enough to switch to full matrix processing fpar[3]*nnz(S) > n^2 default: 3.0 fpar[4] Define the minimum block size which allows the the multilevel ILU to continue with the default reordering strategy (including scaling and pivoting) before switching to a different strategy if a matrix A of size "n" should be factored at the current level, then piluc yiels up to a permutation / B F \ A -> | | such that B is factored \ E C / We continue the multilevel factorization if n-nB<=n*fpar[4] default: 0.75 fpar[5] Provided that a final static pivoting strategy is requested, we may encounter the situation when the regular reodering strategy becomes ineffective, i.e. / B F \ A -> | | such that B is factored \ E C / with B of tiny size (n-nB > n*fpar[4]). In this situation we may switch to a different final pivoting strategy. Like the regular reordering strategy, we may also encounter a situation when the final reordering strategy fails due to a small block B We continue the multilevel factorization with the final pivoting strategy as long as n-nB<=n*fpar[5] default: 0.75 fpar[6] ONLY used if MULTI_PILUC is requested. Multiple, repeated use of piluc without switching to a new level is continued as long as "number of entries skipped" < "number of entries skipped previously" * fpar[6] default: 0.75 fpar[7] drop tolerance for ILUTP (ILDLC), used relative to fpar[0]. default: sqrt(eps) fpar[8,...,19] currently unused fpar[20,...,30] floating parameters required for SPARSKIT solvers fpar[20] relative error tolerance default: sqrt(MACHEPS) fpar[21] absolute error tolerance default: 0 fpar[22]= fpar[23,...30] further parameters used by SPARSKIT solvers default: 0 written by Matthias Bollhoefer, October 2003 */ *flags=param.ipar[6]; //*elbow=param.ipar[0]; *elbow=param.elbow; droptols[0]=param.fpar[0]; droptols[1]=param.fpar[1]; *condest=param.fpar[2]; *restol=param.fpar[20]; *max_it=param.ipar[25];} // end AMGgetparams
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -