Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
pcg_mf.c File Reference

Krylov subspace methods – Preconditioned conjugate gradient (matrix free) More...

#include <math.h>
#include "fasp.h"
#include "fasp_functs.h"
#include "itsolver_util.inl"

Go to the source code of this file.

Functions

INT fasp_solver_pcg (mxv_matfree *mf, dvector *b, dvector *u, precond *pc, const REAL tol, const INT MaxIt, const SHORT stop_type, const SHORT prtlvl)
 Preconditioned conjugate gradient (CG) method for solving Au=b. More...
 

Detailed Description

Krylov subspace methods – Preconditioned conjugate gradient (matrix free)

Abstract algorithm

PCG method to solve A*x=b is to generate {x_k} to approximate x

Step 0. Given A, b, x_0, M

Step 1. Compute residual r_0 = b-A*x_0 and convergence check;

Step 2. Initialization z_0 = M^{-1}*r_0, p_0=z_0;

Step 3. Main loop ...

FOR k = 0:MaxIt

  • get step size alpha = f(r_k,z_k,p_k);
  • update solution: x_{k+1} = x_k + alpha*p_k;
  • perform stagnation check;
  • update residual: r_{k+1} = r_k - alpha*(A*p_k);
  • perform residual check;
  • obtain p_{k+1} using {p_0, p_1, ... , p_k};
  • prepare for next iteration;
  • print the result of k-th iteration; END FOR

Convergence check is: norm(r)/norm(b) < tol

Stagnation check is like following:

  • IF norm(alpha*p_k)/norm(x_{k+1}) < tol_stag
    1. compute r=b-A*x_{k+1};
    2. convergence check;
    3. IF ( not converged & restart_number < Max_Stag_Check ) restart;
  • END IF

Residual check is like following:

  • IF norm(r_{k+1})/norm(b) < tol
    1. compute the real residual r = b-A*x_{k+1};
    2. convergence check;
    3. IF ( not converged & restart_number < Max_Res_Check ) restart;
  • END IF
Note
Refer to Y. Saad 2003 Iterative methods for sparse linear systems (2nd Edition), SIAM

Definition in file pcg_mf.c.

Function Documentation

INT fasp_solver_pcg ( mxv_matfree mf,
dvector b,
dvector u,
precond pc,
const REAL  tol,
const INT  MaxIt,
const SHORT  stop_type,
const SHORT  prtlvl 
)

Preconditioned conjugate gradient (CG) method for solving Au=b.

Parameters
mfPointer to mxv_matfree: the spmv operation
bPointer to dvector: the right hand side
uPointer to dvector: the unknowns
pcPointer to precond: the structure of precondition
tolTolerance for stopping
MaxItMaximal number of iterations
stop_typeStopping criteria type
prtlvlHow much information to print out
Returns
Iteration number if converges; ERROR otherwise.
Author
Chensong Zhang, Xiaozhe Hu, Shiquan Zhang
Date
05/06/2010

Modified by Chensong Zhang on 04/30/2012 Modified by Feiteng Huang on 09/19/2012: matrix free

Definition at line 86 of file pcg_mf.c.