Conjugate gradient method of Golub and van Loan
From CFD-Wiki
Contents |
Conjugate gradient method
Conjugate gradient method could be summarized as follows
System of equation
For the given system of equation
Ax = b ;
b = source vector
x = solution variable for which we seek the solution
A = coefficient matrix
M = the precondioning matrix constructued by matrix A
Algorithm
- Allocate temperary vectors p,z,q
- Allocate temerary reals rho_0, rho_1 , alpha, beta
-
- r := b - Ax
-
- for i := 1 step 1 until max_itr do
- solve (Mz = r )
- beta := rho_0 / rho_1
- p := z + betap
- q := Ap
- alpha = rho_0 / ( pq )
- x := x + alphap
- r := r - alphaq
- rho_1 = rho_0
- solve (Mz = r )
- end (i-loop)
-
- deallocate all temp memory
- return TRUE
Reference
Ferziger, J.H. and Peric, M. 2002. "Computational Methods for Fluid Dynamics", 3rd rev. ed., Springer-Verlag, Berlin.