Choral
Functions/Subroutines
cg_mod Module Reference

CG LINEAR SOLVER = Conjugate Gradient More...

Functions/Subroutines

subroutine, public cg (x, iter, res, b, A, tol, itmax, verb)
 Conjugate gradient (no preconditioning) More...
 
subroutine, public pcg (x, iter, res, b, A, pc, tol, itmax, verb)
 Preconditioned conjugate gradient. More...
 

Detailed Description

CG LINEAR SOLVER = Conjugate Gradient

Source = Youssef SAAD, Iterative methods for sparse linear system
https://www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf

Function/Subroutine Documentation

◆ cg()

subroutine, public cg_mod::cg ( real(rp), dimension(:), intent(inout)  x,
integer, intent(out)  iter,
real(rp), intent(out)  res,
real(rp), dimension(:), intent(in)  b,
procedure(rntorn)  A,
real(rp), intent(in)  tol,
integer, intent(in)  itmax,
integer, intent(in)  verb 
)

Conjugate gradient (no preconditioning)

for the linear system \( Ax = b\)

INPUT/OUTPUT :

  • x = initial guess / solution

OUTPUT :

  • res = final residual
  • iter = number of performed iterations
  • iter = -1 = resolution failure

INPUT :

  • b = RHS
  • A = \( A~:~~~x \mapsto A x \) matrix/vector product (procedural)
  • tol = tolerance
  • itMax = maximal iteration-number
  • verb = verbosity

Definition at line 60 of file cg_mod.f90.

Here is the call graph for this function:

◆ pcg()

subroutine, public cg_mod::pcg ( real(rp), dimension(:), intent(inout)  x,
integer, intent(out)  iter,
real(rp), intent(out)  res,
real(rp), dimension(:), intent(in)  b,
procedure(rntorn)  A,
procedure(rntorn)  pc,
real(rp), intent(in)  tol,
integer, intent(in)  itmax,
integer, intent(in)  verb 
)

Preconditioned conjugate gradient.

for the linear system \( Ax = b\)

and for a preconditionner \( P \)

INPUT/OUTPUT :

  • x = initial guess / solution

OUTPUT :

  • res = final residual
  • iter = number of performed iterations
  • iter = -1 = resolution failure

INPUT :

  • b = RHS
  • A = \( A~:~~~x \mapsto A x \) matrix/vector product (procedural)
  • pc = \( pc~:~~~x \mapsto P^{-1} x \) preconditionner/vector product (procedural)
  • tol = tolerance
  • itMax = maximal iteration-number
  • verb = verbosity

Definition at line 155 of file cg_mod.f90.

Here is the call graph for this function: