NAME
CGS - Conjugate Gradient Squared method for nonsymmetric systems
INCLUDE
include "CGS.h"
SYNTAX
//-----------------------------------------------------------------------------
class CGS : public KrylovItSolver
//-----------------------------------------------------------------------------
{
protected:
NUMT alpha, beta, rho, rho1;
LinEqVector r_bar0;
LinEqVector p;
LinEqVector q;
LinEqVector u;
LinEqVector v;
Handle(LinEqVector) y; // Handles
Handle(LinEqVector) t;
Handle(LinEqVector) tmp;
virtual bool redim (LinEqSystem& system);
public:
CGS ();
CGS (const LinEqSolver_prm& pm);
~CGS () {}
virtual bool ok () const;
virtual bool solve (LinEqSystem& system);
virtual String description () const;
CLASS_INFO;
};
KEYWORDS
iterative methods, linear systems, preconditioner, CGS, nonsym
metric systems
DESCRIPTION
The class implements an attractive variant of the Bi-Conjugate
Gradient method, designed to solve certain classes of nonsymmet
ric linear systems. However, CGS may lead to a rather irregular
convergence behaviour (in contrast to the Bi-Conjugate Gradient
Stabilized method, see class BiCGStab).
CONSTRUCTORS AND INITIALIZATION
There is a default constructor without arguments. For the sake of
comaptibility, there is also a constructor accepting a LinEq
Solver_prm object, aimed to be used by LinEqSolver_prm::create.
MEMBER FUNCTIONS
ok - checks whether all the internal vectors are ready in addi
tion to the standard KrylovItSolver::ok().
solve - takes an input argument of type LinEqSystem which must be
properly filled. The solution process is carried out inside the
function. If successful, a true value will be returned.
EXAMPLES
Mat(real) A(4,4);
Vec(real) x(4), b(4);
A.scan("1 5 4 6 2 4 7 8 4 6 0 9 2 2 5 6");
b.scan("47 63 52 45");
LinEqSystemStd system(A,x,b);
LinEqSolver_prm pm;
pm.basic_method="CGS";
pm.max_iterations=20;
LinEqSolver* cgs = createLinEqSolver (pm);
cgs->solve(system);
SEE ALSO
class LinEqSystem, class KrylovItSolver, class LinEqSolver_prm.
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Xing Cai, UiO/SINTEF Applied Mathematics.