SuperLU 6.0.1
|
Example #2 showing how to use ILU to precondition GMRES. More...
#include "slu_cdefs.h"
Functions | |
void | cpsolve (int n, complex x[], complex y[]) |
Performs cgsisx with original matrix A. More... | |
void | cmatvec_mult (complex alpha, complex x[], complex beta, complex y[]) |
Performs matrix-vector multipliation sp_cgemv with original matrix A. More... | |
int | main (int argc, char *argv[]) |
Variables | |
char * | GLOBAL_EQUED |
superlu_options_t * | GLOBAL_OPTIONS |
float * | GLOBAL_R |
float * | GLOBAL_C |
int * | GLOBAL_PERM_C |
int * | GLOBAL_PERM_R |
SuperMatrix * | GLOBAL_A |
SuperMatrix * | GLOBAL_A_ORIG |
SuperMatrix * | GLOBAL_L |
SuperMatrix * | GLOBAL_U |
SuperLUStat_t * | GLOBAL_STAT |
mem_usage_t * | GLOBAL_MEM_USAGE |
This example shows that ILU is computed from the equilibrated matrix, but the preconditioned GMRES is applied to the original system. The driver routine CGSISX is called twice to perform factorization and apply preconditioner separately.
Note that CGSISX performs the following factorization: Pr*Dr*A*Dc*Pc^T ~= LU with Pr being obtained from MC64 statically then partial pivoting dynamically. On return, A is overwritten as A1 = Dr*A*Dc.
We need to save a copy of the original matrix A, then solve the original system, A*x = B, using FGMRES. Each GMRES step requires requires 2 procedures: 1) Apply preconditioner M^{-1} = Dc*Pc^T*U^{-1}*L^{-1}*Pr*Dr 2) Matrix-vector multiplication: w = A*v
The operations is y := alpha*A*x + beta*y. See documentation of sp_cgemv for further details.
[in] | alpha | Scalar factor for A*x |
[in] | x | Vector to multiply with A |
[in] | beta | Scalar factor for y |
[in,out] | y | Vector to add to to matrix-vector multiplication and storage for result. |
See documentation of cgsisx for more details.
[in] | n | Dimension of matrices |
[out] | x | Solution |
[in,out] | y | Right-hand side |
int main | ( | int | argc, |
char * | argv[] | ||
) |
SuperMatrix* GLOBAL_A |
SuperMatrix * GLOBAL_A_ORIG |
float * GLOBAL_C |
char* GLOBAL_EQUED |
SuperMatrix * GLOBAL_L |
mem_usage_t* GLOBAL_MEM_USAGE |
superlu_options_t* GLOBAL_OPTIONS |
int* GLOBAL_PERM_C |
int * GLOBAL_PERM_R |
float* GLOBAL_R |
SuperLUStat_t* GLOBAL_STAT |
SuperMatrix * GLOBAL_U |