#include <SolveCG.h>
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. |
Definition at line 59 of file SolveCG.h.
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.
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.
relaxfac | relaxation parameter |
int Go::SolveCG::solve | ( | double * | ex, | |
double * | eb, | |||
int | nn | |||
) |
Solve the equation system by conjugate gradient method.
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. |
void Go::SolveCG::setTolerance | ( | double | tolerance = 1.0e-6 |
) | [inline] |
void Go::SolveCG::setMaxIterations | ( | int | max_iterations | ) | [inline] |