ConicBundle
pcg.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CH_MATRIX_CLASSES__PCG_HXX
4 #define CH_MATRIX_CLASSES__PCG_HXX
5 
15 
16 namespace CH_Matrix_Classes {
17 
21 
30  class PCG: public IterativeSolverObject
31  {
32  private:
40 
45 
47 
48 
49  std::ostream* myout;
51 
52  public:
54  PCG(std::ostream* out=0,int pril=-1);
56  ~PCG(){}
57 
64 
66  void set_maxit(Integer in_maxit) {maxit=in_maxit;}
68  Integer get_maxit() const {return maxit;}
69 
71  int get_err() const {return err;}
73  Integer get_nmult() const {return nmult;}
75  Real get_residual_norm() const {return resnorm;}
77  virtual Real get_avg_reduction() const {return avg_reduction;}
79  virtual Real get_termprec() const {return termprec;}
80 
82 
84  int compute(IterativeSystemObject& system,
85  Matrix& x,
86  Real termprec,
87  Matrix* storex=0,
88  Integer storestep=0
89  );
90 
95 
97  virtual void set_out(std::ostream* in_out=0,int in_print_level=1)
98  {myout=in_out;print_level=in_print_level;}
99 
101  };
102 
104 
105 }
106 
107 #endif
108 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
Integer get_maxit() const
get maximum number of iterations
Definition: pcg.hxx:68
virtual Real get_avg_reduction() const
returns the average of the achieved reduction factor per iteration
Definition: pcg.hxx:77
Header declaring the abstract classes CH_Matrix_Classes::IterativeSystemObject and CH_Matrix_Classes:...
Integer err
error code
Definition: pcg.hxx:39
Preconditioned Conjugate Gradient method for solving Ax=b with (symmetric) positive definite matrix A...
Definition: pcg.hxx:30
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
Real termprec
absolute precision required in the last call
Definition: pcg.hxx:37
PCG(std::ostream *out=0, int pril=-1)
default constructor
Matrix z
temporary residual for step computation
Definition: pcg.hxx:43
Matrix Ap
result of matrix multiplication
Definition: pcg.hxx:41
Integer nmult
number of matrix vector multiplications/iterations
Definition: pcg.hxx:38
int get_err() const
returns the error code of the last call
Definition: pcg.hxx:71
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)
Definition: pcg.hxx:97
Integer get_nmult() const
returns the number of matrix-vector multiplications of the last call
Definition: pcg.hxx:73
Integer stall
counts number of time reduction was less than .999
Definition: pcg.hxx:46
virtual Real get_termprec() const
return the (absolute) precision requirement for termination used in the last call ...
Definition: pcg.hxx:79
std::ostream * myout
everything is output to *myout, default: 0 for no output
Definition: pcg.hxx:49
Real resnorm
residual norm
Definition: pcg.hxx:34
Integer maxit
maximum number of matrix vector multiplications
Definition: pcg.hxx:33
void set_maxit(Integer in_maxit)
set maximum number of iterations
Definition: pcg.hxx:66
Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick intro...
Definition: PSCOracle.hxx:20
int print_level
level of iteration information that should be displayed
Definition: pcg.hxx:50
Abstract base class for supplying the system for an iterative solver.
Definition: IterativeSystemObject.hxx:37
Matrix r
residual
Definition: pcg.hxx:42
Matrix class for real values of type Real
Definition: matrix.hxx:74
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 ...
Matrix p
step
Definition: pcg.hxx:44
Real old_resnorm
residual norm in the previous step
Definition: pcg.hxx:35
Real avg_reduction
average over the reduction factors
Definition: pcg.hxx:36
Real get_residual_norm() const
returns the residual norm of last call
Definition: pcg.hxx:75
Abstract interface to iterative methods for solving Ax=b given by an IterativeSystemObject.
Definition: IterativeSystemObject.hxx:61