Class to solve systems of linear equations by direct or iterative methods. More...
#include <LinearSolver.h>
Public Member Functions | |
| LinearSolver () | |
| Default Constructor. | |
| LinearSolver (int max_it, real_t tolerance) | |
| Constructor with iteration parameters. | |
| LinearSolver (SpMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using matrix, right-hand side and solution vector. | |
| LinearSolver (SkMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using skyline-stored matrix, right-hand side and solution vector. | |
| LinearSolver (TrMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using a tridiagonal matrix, right-hand side and solution vector. | |
| LinearSolver (BMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using a banded matrix, right-hand side and solution vector. | |
| LinearSolver (DMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using a dense matrix, right-hand side and solution vector. | |
| LinearSolver (DSMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using a dense symmetric matrix, right-hand side and solution vector. | |
| LinearSolver (SkSMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using skyline-stored symmetric matrix, right-hand side and solution vector. | |
| LinearSolver (SkMatrix< real_t > &A, Vect< real_t > &b, Vect< real_t > &x) | |
| Constructor using matrix, right-hand side. | |
| virtual | ~LinearSolver () |
| Destructor. | |
| void | setMaxIter (int m) |
| Set Maximum number of iterations. | |
| void | setTolerance (real_t tol) |
| Set tolerance value. | |
| void | setSolution (Vect< real_t > &x) |
| Set solution vector. | |
| void | setRHS (Vect< real_t > &b) |
| Set right-hand side vector. | |
| void | setMatrix (Matrix< real_t > *A) |
| Set matrix in the case of a pointer to Matrix. | |
| void | setMatrix (SpMatrix< real_t > &A) |
| Set matrix in the case of a pointer to matrix. | |
| void | setMatrix (SkMatrix< real_t > &A) |
| Set matrix in the case of a skyline matrix. | |
| void | set (SpMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x) |
| Set matrix, right-hand side and initial guess. | |
| void | setSolver (Iteration s, Preconditioner p=DIAG_PREC) |
| Set solver and preconditioner. | |
| Iteration | getSolver () const |
| Return solver code. | |
| Preconditioner | getPreconditioner () const |
| Return solver preconditioner. | |
| int | solve (SpMatrix< real_t > &A, const Vect< real_t > &b, Vect< real_t > &x, Iteration s, Preconditioner p=DIAG_PREC) |
| Solve equations using system data, prescribed solver and preconditioner. | |
| int | solve (Iteration s, Preconditioner p=DIAG_PREC) |
| Solve equations using prescribed solver and preconditioner. | |
| int | solve () |
| Solve equations all arguments must have been given by other member functions. | |
| void | setFact () |
| Factorize matrix. | |
| void | setNoFact () |
| Do not factorize matrix. | |
| int | getNbIter () const |
| Get number of performed iterations. | |
Class to solve systems of linear equations by direct or iterative methods.
| LinearSolver | ( | ) |
Default Constructor.
Initializes default parameters and pointers to 0.
| LinearSolver | ( | int | max_it, |
| real_t | tolerance ) |
Constructor with iteration parameters.
| [in] | max_it | Maximal number of iterations |
| [in] | tolerance | Tolerance for convergence (measured in relative weighted 2-Norm) in input, effective discrepancy in output. |
| LinearSolver | ( | SpMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | SkMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | TrMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | BMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | DMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | DSMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | SkSMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
| LinearSolver | ( | SkMatrix< real_t > & | A, |
| Vect< real_t > & | b, | ||
| Vect< real_t > & | x ) |
Set matrix, right-hand side and initial guess.
| [in] | A | Reference to matrix as a SpMatrix instance |
| [in] | b | Vector containing right-hand side |
| [in,out] | x | Vector containing initial guess on input and solution on output |
| void setMatrix | ( | Matrix< real_t > * | A | ) |
| void setMatrix | ( | SkMatrix< real_t > & | A | ) |
Set matrix in the case of a skyline matrix.
| [in] | A | Matrix as instance of class SkMatrix |
| void setMatrix | ( | SpMatrix< real_t > & | A | ) |
Set matrix in the case of a pointer to matrix.
| [in] | A | Pointer to abstract Matrix class |
| void setMaxIter | ( | int | m | ) |
Set Maximum number of iterations.
Default value is 1000
| void setSolver | ( | Iteration | s, |
| Preconditioner | p = DIAG_PREC ) |
Set solver and preconditioner.
| [in] | s | Solver identification parameter. To be chosen in the enumeration variable Iteration:DIRECT_SOLVER, CG_SOLVER, CGS_SOLVER, BICG_SOLVER, BICG_STAB_SOLVER, GMRES_SOLVER, QMR_SOLVER |
| [in] | p | Preconditioner identification parameter. By default, the diagonal preconditioner is used. To be chosen in the enumeration variable Preconditioner:IDENT_PREC, DIAG_PREC, SSOR_PREC, ILU_PREC [Default: ILU_PREC] |
p has no effect if the solver is DIRECT_SOLVER | int solve | ( | ) |
Solve equations all arguments must have been given by other member functions.
Solver and preconditioner parameters must have been set by function setSolver. Otherwise, default values are set.
| int solve | ( | Iteration | s, |
| Preconditioner | p = DIAG_PREC ) |
Solve equations using prescribed solver and preconditioner.
| [in] | s | Solver identification parameter To be chosen in the enumeration variable Iteration:DIRECT_SOLVER, CG_SOLVER, CGS_SOLVER, BICG_SOLVER, BICG_STAB_SOLVER, GMRES_SOLVER, QMR_SOLVER [Default: CGS_SOLVER] |
| [in] | p | Preconditioner identification parameter. To be chosen in the enumeration variable Preconditioner:IDENT_PREC, DIAG_PREC, SSOR_PREC, DILU_PREC, ILU_PREC [Default: DIAG_PREC] |
p has no effect if the solver is DIRECT_SOLVER | int solve | ( | SpMatrix< real_t > & | A, |
| const Vect< real_t > & | b, | ||
| Vect< real_t > & | x, | ||
| Iteration | s, | ||
| Preconditioner | p = DIAG_PREC ) |
Solve equations using system data, prescribed solver and preconditioner.
| [in] | A | Reference to matrix as a SpMatrix instance |
| [in] | b | Vector containing right-hand side |
| [in,out] | x | Vector containing initial guess on input and solution on output |
| [in] | s | Solver identification parameter To be chosen in the enumeration variable Iteration:DIRECT_SOLVER, CG_SOLVER, CGS_SOLVER, BICG_SOLVER, BICG_STAB_SOLVER, GMRES_SOLVER, QMR_SOLVER [Default: CGS_SOLVER] |
| [in] | p | Preconditioner identification parameter. To be chosen in the enumeration variable Preconditioner:IDENT_PREC, DIAG_PREC, SSOR_PREC, ILU_PREC, DILU_PREC [Default: DIAG_PREC] |
p has no effect if the solver is DIRECT_SOLVER