Go::SolveCG Class Reference
['geometry' - a spline library]

Solve the equation system Ax=b where A is a symmetric positive definite matrix using the Conjugate Gradient Method. More...

#include <SolveCG.h>

List of all members.

Public Member Functions

 SolveCG ()
 Default constructor.
 ~SolveCG ()
 Destructor.
void attachMatrix (double *gmat, int nn)
 Attach the left side of the equation system to the current object and represent the matrix as a sparse matrix.
void precondRILU (double relaxfac)
 Prepare for preconditioning.
int solve (double *ex, double *eb, int nn)
 Solve the equation system by conjugate gradient method.
void setTolerance (double tolerance=1.0e-6)
 Set numerical tolerance used by the solver.
void setMaxIterations (int max_iterations)
 Set the maximal number of iterations to be used by the solver.


Detailed Description

Solve the equation system Ax=b where A is a symmetric positive definite matrix using the Conjugate Gradient Method.

Definition at line 59 of file SolveCG.h.


Member Function Documentation

void Go::SolveCG::attachMatrix ( double *  gmat,
int  nn 
)

Attach the left side of the equation system to the current object and represent the matrix as a sparse matrix.

No test is applied on whether the matrix really is symmetric and positive definite.

Parameters:
gmat the system matrix for the linear equations. Size is nn*nn, stored columnwise.
nn the number of unknowns in the system.

void Go::SolveCG::precondRILU ( double  relaxfac  ) 

Prepare for preconditioning.

Parameters:
relaxfac relaxation parameter

int Go::SolveCG::solve ( double *  ex,
double *  eb,
int  nn 
)

Solve the equation system by conjugate gradient method.

Parameters:
ex the solution vector. The input should be the initial guess. Size is equal to nn.
eb the right side of the equation. Size is equal to nn.
nn the number of unknowns int the system.
Returns:
0: success, 1: iterationcount exceeded, < 0: error.

void Go::SolveCG::setTolerance ( double  tolerance = 1.0e-6  )  [inline]

Set numerical tolerance used by the solver.

Parameters:
tolerance numerical tolerance.

Definition at line 92 of file SolveCG.h.

void Go::SolveCG::setMaxIterations ( int  max_iterations  )  [inline]

Set the maximal number of iterations to be used by the solver.

Parameters:
max_iterations the maximal number of iterations.

Definition at line 97 of file SolveCG.h.


The documentation for this class was generated from the following file:
Generated on Mon Jun 11 14:48:19 2007 for GoTools Core Library by  doxygen 1.5.1