|
| GMRES () |
| Default constructor. More...
|
|
template<typename MatrixDerived > |
| GMRES (const EigenBase< MatrixDerived > &A) |
| Initialize the solver with matrix A for further Ax=b solving. More...
|
|
int | get_restart () |
| Get the number of iterations after that a restart is performed.
|
|
void | set_restart (const int restart) |
| Set the number of iterations after that a restart is performed. More...
|
|
template<typename Rhs , typename Guess > |
const internal::solve_retval_with_guess< GMRES, Rhs, Guess > | solveWithGuess (const MatrixBase< Rhs > &b, const Guess &x0) const |
|
template<typename Rhs , typename Dest > |
void | _solveWithGuess (const Rhs &b, Dest &x) const |
|
template<typename Rhs , typename Dest > |
void | _solve (const Rhs &b, Dest &x) const |
|
GMRES< _MatrixType, _Preconditioner > & | derived () |
|
const GMRES< _MatrixType, _Preconditioner > & | derived () const |
|
| IterativeSolverBase () |
| Default constructor. More...
|
|
| IterativeSolverBase (const EigenBase< InputDerived > &A) |
| Initialize the solver with matrix A for further Ax=b solving. More...
|
|
GMRES< _MatrixType, _Preconditioner > & | analyzePattern (const EigenBase< InputDerived > &A) |
| Initializes the iterative solver for the sparcity pattern of the matrix A for further solving Ax=b problems. More...
|
|
GMRES< _MatrixType, _Preconditioner > & | factorize (const EigenBase< InputDerived > &A) |
| Initializes the iterative solver with the numerical values of the matrix A for further solving Ax=b problems. More...
|
|
GMRES< _MatrixType, _Preconditioner > & | compute (const EigenBase< InputDerived > &A) |
| Initializes the iterative solver with the matrix A for further solving Ax=b problems. More...
|
|
Index | rows () const |
|
Index | cols () const |
|
RealScalar | tolerance () const |
|
GMRES< _MatrixType, _Preconditioner > & | setTolerance (const RealScalar &tolerance) |
| Sets the tolerance threshold used by the stopping criteria.
|
|
Preconditioner & | preconditioner () |
|
const Preconditioner & | preconditioner () const |
|
int | maxIterations () const |
|
GMRES< _MatrixType, _Preconditioner > & | setMaxIterations (int maxIters) |
| Sets the max number of iterations.
|
|
int | iterations () const |
|
RealScalar | error () const |
|
const internal::solve_retval< GMRES< _MatrixType, _Preconditioner >, Rhs > | solve (const MatrixBase< Rhs > &b) const |
|
const internal::sparse_solve_retval< IterativeSolverBase, Rhs > | solve (const SparseMatrixBase< Rhs > &b) const |
|
ComputationInfo | info () const |
|
void | _solve_sparse (const Rhs &b, SparseMatrix< DestScalar, DestOptions, DestIndex > &dest) const |
|
template<typename _MatrixType, typename _Preconditioner>
class Eigen::GMRES< _MatrixType, _Preconditioner >
A GMRES solver for sparse square problems.
This class allows to solve for A.x = b sparse linear problems using a generalized minimal residual method. The vectors x and b can be either dense or sparse.
- Template Parameters
-
_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. |
_Preconditioner | the type of the preconditioner. Default is DiagonalPreconditioner |
The maximal number of iterations and tolerance value can be controlled via the setMaxIterations() and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance.
This class can be used as the direct solver classes. Here is a typical usage example:
int n = 10000;
VectorXd x(n), b(n);
SparseMatrix<double> A(n,n);
GMRES<SparseMatrix<double> > solver(A);
x = solver.solve(b);
std::cout << "#iterations: " << solver.iterations() << std::endl;
std::cout << "estimated error: " << solver.error() << std::endl;
x = solver.solve(b);
By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the solveWithGuess() method.
- See also
- class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner