ConicBundle
|
Preconditioned Conjugate Gradient method for solving Ax=b with (symmetric) positive definite matrix A and positive definite preconditioner M1 where the preconditioned system is A'x'=b' with A'=M1^{-.5}AM1^{-.5}, x'=M1^{.5}*x and b'=M1^{-.5}b. System matrix and preconditioner are provided by a CH_Matrix_Classes::IterativeSystemObject. More...
#include <pcg.hxx>
Public Member Functions | |
PCG (std::ostream *out=0, int pril=-1) | |
default constructor | |
int | compute (IterativeSystemObject &system, Matrix &x, Real termprec, Matrix *storex=0, Integer storestep=0) |
compute the solution for system into x with (absolute) residual precision termprec More... | |
Set and Get Parameters | |
There should be no need to set any parameters, default values should be available and reasonable. | |
void | set_maxit (Integer in_maxit) |
set maximum number of iterations | |
Integer | get_maxit () const |
get maximum number of iterations | |
int | get_err () const |
returns the error code of the last call | |
Integer | get_nmult () const |
returns the number of matrix-vector multiplications of the last call | |
Real | get_residual_norm () const |
returns the residual norm of last call | |
virtual Real | get_avg_reduction () const |
returns the average of the achieved reduction factor per iteration | |
virtual Real | get_termprec () const |
return the (absolute) precision requirement for termination used in the last call | |
Input/Output | |
virtual void | set_out (std::ostream *in_out=0, int in_print_level=1) |
set output stream and level of detail of log output (for debugging) | |
Set and Get Parameters | |
There should be no need to set any parameters, default values should be available and reasonable. | |
Input/Output |
Private Attributes | |
Integer | maxit |
maximum number of matrix vector multiplications | |
Real | resnorm |
residual norm | |
Real | old_resnorm |
residual norm in the previous step | |
Real | avg_reduction |
average over the reduction factors | |
Real | termprec |
absolute precision required in the last call | |
Integer | nmult |
number of matrix vector multiplications/iterations | |
Integer | err |
error code | |
Matrix | Ap |
result of matrix multiplication | |
Matrix | r |
residual | |
Matrix | z |
temporary residual for step computation | |
Matrix | p |
step | |
Integer | stall |
counts number of time reduction was less than .999 | |
std::ostream * | myout |
everything is output to *myout, default: 0 for no output | |
int | print_level |
level of iteration information that should be displayed | |
Preconditioned Conjugate Gradient method for solving Ax=b with (symmetric) positive definite matrix A and positive definite preconditioner M1 where the preconditioned system is A'x'=b' with A'=M1^{-.5}AM1^{-.5}, x'=M1^{.5}*x and b'=M1^{-.5}b. System matrix and preconditioner are provided by a CH_Matrix_Classes::IterativeSystemObject.
|
virtual |
compute the solution for system into x with (absolute) residual precision termprec
system | the system informatin with precond |
x | on input: starting point (x.dim()==0 uses 0-vector), on output: approx. sol., |
termprec | !absolute! termination precission, stop if residual norm<= termprec, |
storex | if not null, store initial x and the x of i*recordstep |
storestep | if 0 and xrecord!=0 store only the initial x |
Implements CH_Matrix_Classes::IterativeSolverObject.
Referenced by get_termprec().