Eigen  5.0.1
 
Loading...
Searching...
No Matches
Eigen::IterativeSolverBase< Derived > Class Template Reference

#include <Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h>

Detailed Description

template<typename Derived>
class Eigen::IterativeSolverBase< Derived >

Base class for linear iterative solvers.

See also
class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
+ Inheritance diagram for Eigen::IterativeSolverBase< Derived >:

Public Member Functions

template<typename MatrixDerived>
Derived & analyzePattern (const EigenBase< MatrixDerived > &A)
 
template<typename MatrixDerived>
Derived & compute (const EigenBase< MatrixDerived > &A)
 
RealScalar error () const
 
template<typename MatrixDerived>
Derived & factorize (const EigenBase< MatrixDerived > &A)
 
ComputationInfo info () const
 
Index iterations () const
 
 IterativeSolverBase ()
 
template<typename MatrixDerived>
 IterativeSolverBase (const EigenBase< MatrixDerived > &A)
 
Index maxIterations () const
 
Preconditioner & preconditioner ()
 
const Preconditioner & preconditioner () const
 
Derived & setMaxIterations (Index maxIters)
 
Derived & setTolerance (const RealScalar &tolerance)
 
template<typename Rhs, typename Guess>
const SolveWithGuess< Derived, Rhs, Guess > solveWithGuess (const MatrixBase< Rhs > &b, const Guess &x0) const
 
template<typename Rhs, typename Dest>
void solveWithGuessInPlace (const Rhs &b, Dest &x) const
 
RealScalar tolerance () const
 
- Public Member Functions inherited from Eigen::SparseSolverBase< Derived >
template<typename Rhs>
Solve< Derived, Rhs > solve (const MatrixBase< Rhs > &b) const
 
template<typename Rhs>
Solve< Derived, Rhs > solve (const SparseMatrixBase< Rhs > &b) const
 
 SparseSolverBase ()=default
 

Constructor & Destructor Documentation

◆ IterativeSolverBase() [1/2]

template<typename Derived>
Eigen::IterativeSolverBase< Derived >::IterativeSolverBase ( )
inline

Default constructor.

◆ IterativeSolverBase() [2/2]

template<typename Derived>
template<typename MatrixDerived>
Eigen::IterativeSolverBase< Derived >::IterativeSolverBase ( const EigenBase< MatrixDerived > & A)
inlineexplicit

Initialize the solver with matrix A for further Ax=b solving.

This constructor is a shortcut for the default constructor followed by a call to compute().

Warning
this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if A is changed this class becomes invalid. Call compute() to update it with the new matrix A, or modify a copy of A.

Member Function Documentation

◆ analyzePattern()

template<typename Derived>
template<typename MatrixDerived>
Derived & Eigen::IterativeSolverBase< Derived >::analyzePattern ( const EigenBase< MatrixDerived > & A)
inline

Initializes the iterative solver for the sparsity pattern of the matrix A for further solving Ax=b problems.

Currently, this function mostly calls analyzePattern on the preconditioner. In the future we might, for instance, implement column reordering for faster matrix vector products.

◆ compute()

template<typename Derived>
template<typename MatrixDerived>
Derived & Eigen::IterativeSolverBase< Derived >::compute ( const EigenBase< MatrixDerived > & A)
inline

Initializes the iterative solver with the matrix A for further solving Ax=b problems.

Currently, this function mostly initializes/computes the preconditioner. In the future we might, for instance, implement column reordering for faster matrix vector products.

Warning
this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if A is changed this class becomes invalid. Call compute() to update it with the new matrix A, or modify a copy of A.

◆ error()

template<typename Derived>
RealScalar Eigen::IterativeSolverBase< Derived >::error ( ) const
inline
Returns
the tolerance error reached during the last solve. It is a close approximation of the true relative residual error |Ax-b|/|b|, unless the solver documents a different measure: LeastSquaresConjugateGradient reports the normal-equation residual |A'(Ax-b)|/|A'b|, and LSMR reports the normal-equation residual estimate |A'(Ax-b)|/(|A| |Ax-b|).

◆ factorize()

template<typename Derived>
template<typename MatrixDerived>
Derived & Eigen::IterativeSolverBase< Derived >::factorize ( const EigenBase< MatrixDerived > & A)
inline

Initializes the iterative solver with the numerical values of the matrix A for further solving Ax=b problems.

Currently, this function mostly calls factorize on the preconditioner.

Warning
this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if A is changed this class becomes invalid. Call compute() to update it with the new matrix A, or modify a copy of A.

◆ info()

template<typename Derived>
ComputationInfo Eigen::IterativeSolverBase< Derived >::info ( ) const
inline
Returns
Success if the iterations converged, and NoConvergence otherwise.

◆ iterations()

template<typename Derived>
Index Eigen::IterativeSolverBase< Derived >::iterations ( ) const
inline
Returns
the number of iterations performed during the last solve

◆ maxIterations()

template<typename Derived>
Index Eigen::IterativeSolverBase< Derived >::maxIterations ( ) const
inline
Returns
the max number of iterations. It is either the value set by setMaxIterations or, by default, twice the number of columns of the matrix.

◆ preconditioner() [1/2]

template<typename Derived>
Preconditioner & Eigen::IterativeSolverBase< Derived >::preconditioner ( )
inline
Returns
a read-write reference to the preconditioner for custom configuration.

◆ preconditioner() [2/2]

template<typename Derived>
const Preconditioner & Eigen::IterativeSolverBase< Derived >::preconditioner ( ) const
inline
Returns
a read-only reference to the preconditioner.

◆ setMaxIterations()

template<typename Derived>
Derived & Eigen::IterativeSolverBase< Derived >::setMaxIterations ( Index maxIters)
inline

Sets the max number of iterations. Default is twice the number of columns of the matrix.

◆ setTolerance()

template<typename Derived>
Derived & Eigen::IterativeSolverBase< Derived >::setTolerance ( const RealScalar & tolerance)
inline

Sets the tolerance threshold used by the stopping criteria.

This value is used as an upper bound to the relative residual error: |Ax-b|/|b|, or to the measure the solver documents instead; LeastSquaresConjugateGradient bounds the normal-equation residual |A'(Ax-b)|/|A'b|, and LSMR bounds |A'(Ax-b)|/(|A| |Ax-b|). The default value is the machine precision given by NumTraits<Scalar>::epsilon()

◆ solveWithGuess()

template<typename Derived>
template<typename Rhs, typename Guess>
const SolveWithGuess< Derived, Rhs, Guess > Eigen::IterativeSolverBase< Derived >::solveWithGuess ( const MatrixBase< Rhs > & b,
const Guess & x0 ) const
inline
Returns
the solution x of \( A x = b \) using the current decomposition of A and x0 as an initial solution.
See also
solve(), compute()

◆ solveWithGuessInPlace()

template<typename Derived>
template<typename Rhs, typename Dest>
void Eigen::IterativeSolverBase< Derived >::solveWithGuessInPlace ( const Rhs & b,
Dest & x ) const
inline

Solves \( A x = b \) in place: x holds the initial guess on entry and the solution on exit, and info(), iterations() and error() report on the run.

solve() and solveWithGuess() return expressions and therefore require Eigen dense or sparse operands. This entry point accepts any single-column right-hand side and solution types that provide the vector operations the algorithm uses, for instance the device-resident vectors of the GPU module (contrib/Eigen/GPU) together with a matrix-free matrix type.

See also
solve(), solveWithGuess()

◆ tolerance()

template<typename Derived>
RealScalar Eigen::IterativeSolverBase< Derived >::tolerance ( ) const
inline
Returns
the tolerance threshold used by the stopping criteria.
See also
setTolerance()

The documentation for this class was generated from the following file: