compbio
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Eigen::DGMRES< _MatrixType, _Preconditioner > Class Template Reference

A Restarted GMRES with deflation. More...

#include <DGMRES.h>

Inheritance diagram for Eigen::DGMRES< _MatrixType, _Preconditioner >:
Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > > Eigen::SparseSolverBase< DGMRES< _MatrixType, _Preconditioner > > Eigen::internal::noncopyable

Public Types

typedef _MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::Index Index
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef MatrixType::RealScalar RealScalar
 
typedef _Preconditioner Preconditioner
 
typedef Matrix< Scalar, Dynamic, DynamicDenseMatrix
 
typedef Matrix< RealScalar, Dynamic, DynamicDenseRealMatrix
 
typedef Matrix< Scalar, Dynamic, 1 > DenseVector
 
typedef Matrix< RealScalar, Dynamic, 1 > DenseRealVector
 
typedef Matrix< std::complex< RealScalar >, Dynamic, 1 > ComplexVector
 
- Public Types inherited from Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > >
enum  
 
typedef internal::traits< DGMRES< _MatrixType, _Preconditioner > >::MatrixType MatrixType
 
typedef internal::traits< DGMRES< _MatrixType, _Preconditioner > >::Preconditioner Preconditioner
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef MatrixType::RealScalar RealScalar
 

Public Member Functions

 DGMRES ()
 Default constructor. More...
 
template<typename MatrixDerived >
 DGMRES (const EigenBase< MatrixDerived > &A)
 Initialize the solver with matrix A for further Ax=b solving. More...
 
template<typename Rhs , typename Dest >
void _solve_with_guess_impl (const Rhs &b, Dest &x) const
 
template<typename Rhs , typename Dest >
void _solve_impl (const Rhs &b, MatrixBase< Dest > &x) const
 
int restart ()
 Get the restart value.
 
void set_restart (const int restart)
 Set the restart value (default is 30)
 
void setEigenv (const int neig)
 Set the number of eigenvalues to deflate at each restart.
 
int deflSize ()
 Get the size of the deflation subspace size.
 
void setMaxEigenv (const int maxNeig)
 Set the maximum size of the deflation subspace.
 
- Public Member Functions inherited from Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > >
 IterativeSolverBase ()
 Default constructor. More...
 
 IterativeSolverBase (const EigenBase< MatrixDerived > &A)
 Initialize the solver with matrix A for further Ax=b solving. More...
 
DGMRES< _MatrixType, _Preconditioner > & analyzePattern (const EigenBase< MatrixDerived > &A)
 Initializes the iterative solver for the sparsity pattern of the matrix A for further solving Ax=b problems. More...
 
DGMRES< _MatrixType, _Preconditioner > & factorize (const EigenBase< MatrixDerived > &A)
 Initializes the iterative solver with the numerical values of the matrix A for further solving Ax=b problems. More...
 
DGMRES< _MatrixType, _Preconditioner > & compute (const EigenBase< MatrixDerived > &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
 
DGMRES< _MatrixType, _Preconditioner > & setTolerance (const RealScalar &tolerance)
 Sets the tolerance threshold used by the stopping criteria. More...
 
Preconditioner & preconditioner ()
 
const Preconditioner & preconditioner () const
 
Index maxIterations () const
 
DGMRES< _MatrixType, _Preconditioner > & setMaxIterations (Index maxIters)
 Sets the max number of iterations. More...
 
Index iterations () const
 
RealScalar error () const
 
const SolveWithGuess< DGMRES< _MatrixType, _Preconditioner >, Rhs, Guess > solveWithGuess (const MatrixBase< Rhs > &b, const Guess &x0) const
 
ComputationInfo info () const
 
void _solve_impl (const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const
 
- Public Member Functions inherited from Eigen::SparseSolverBase< DGMRES< _MatrixType, _Preconditioner > >
 SparseSolverBase ()
 Default constructor.
 
DGMRES< _MatrixType, _Preconditioner > & derived ()
 
const DGMRES< _MatrixType, _Preconditioner > & derived () const
 
const Solve< DGMRES< _MatrixType, _Preconditioner >, Rhs > solve (const MatrixBase< Rhs > &b) const
 
const Solve< DGMRES< _MatrixType, _Preconditioner >, Rhs > solve (const SparseMatrixBase< Rhs > &b) const
 
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 

Protected Member Functions

template<typename Rhs , typename Dest >
void dgmres (const MatrixType &mat, const Rhs &rhs, Dest &x, const Preconditioner &precond) const
 Perform several cycles of restarted GMRES with modified Gram Schmidt,. More...
 
template<typename Dest >
int dgmresCycle (const MatrixType &mat, const Preconditioner &precond, Dest &x, DenseVector &r0, RealScalar &beta, const RealScalar &normRhs, int &nbIts) const
 Perform one restart cycle of DGMRES. More...
 
int dgmresComputeDeflationData (const MatrixType &mat, const Preconditioner &precond, const Index &it, StorageIndex &neig) const
 
template<typename RhsType , typename DestType >
int dgmresApplyDeflation (const RhsType &In, DestType &Out) const
 
ComplexVector schurValues (const ComplexSchur< DenseMatrix > &schurofH) const
 
ComplexVector schurValues (const RealSchur< DenseMatrix > &schurofH) const
 
void dgmresInitDeflation (Index &rows) const
 
- Protected Member Functions inherited from Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > >
void init ()
 
const ActualMatrixType & matrix () const
 
void grab (const InputType &A)
 

Protected Attributes

DenseMatrix m_V
 
DenseMatrix m_H
 
DenseMatrix m_Hes
 
Index m_restart
 
DenseMatrix m_U
 
DenseMatrix m_MU
 
DenseMatrix m_T
 
PartialPivLU< DenseMatrixm_luT
 
StorageIndex m_neig
 
int m_r
 
int m_maxNeig
 
RealScalar m_lambdaN
 
bool m_isDeflAllocated
 
bool m_isDeflInitialized
 
RealScalar m_smv
 
bool m_force
 
- Protected Attributes inherited from Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > >
MatrixWrapper m_matrixWrapper
 
Preconditioner m_preconditioner
 
Index m_maxIterations
 
RealScalar m_tolerance
 
RealScalar m_error
 
Index m_iterations
 
ComputationInfo m_info
 
bool m_analysisIsOk
 
bool m_factorizationIsOk
 
- Protected Attributes inherited from Eigen::SparseSolverBase< DGMRES< _MatrixType, _Preconditioner > >
bool m_isInitialized
 

Additional Inherited Members

- Protected Types inherited from Eigen::IterativeSolverBase< DGMRES< _MatrixType, _Preconditioner > >
typedef SparseSolverBase< DGMRES< _MatrixType, _Preconditioner > > Base
 
typedef internal::generic_matrix_wrapper< MatrixType > MatrixWrapper
 
typedef MatrixWrapper::ActualMatrixType ActualMatrixType
 

Detailed Description

template<typename _MatrixType, typename _Preconditioner>
class Eigen::DGMRES< _MatrixType, _Preconditioner >

A Restarted GMRES with deflation.

This class implements a modification of the GMRES solver for sparse linear systems. The basis is built with modified Gram-Schmidt. At each restart, a few approximated eigenvectors corresponding to the smallest eigenvalues are used to build a preconditioner for the next cycle. This preconditioner for deflation can be combined with any other preconditioner, the IncompleteLUT for instance. The preconditioner is applied at right of the matrix and the combination is multiplicative.

Template Parameters
_MatrixTypethe type of the sparse matrix A, can be a dense or a sparse matrix.
_Preconditionerthe type of the preconditioner. Default is DiagonalPreconditioner Typical usage :
SparseMatrix<double> A;
VectorXd x, b;
//Fill A and b ...
DGMRES<SparseMatrix<double> > solver;
solver.set_restart(30); // Set restarting value
solver.setEigenv(1); // Set the number of eigenvalues to deflate
solver.compute(A);
x = solver.solve(b);

DGMRES can also be used in a matrix-free context, see the following example .

References : [1] D. NUENTSA WAKAM and F. PACULL, Memory Efficient Hybrid Algebraic Solvers for Linear Systems Arising from Compressible Flows, Computers and Fluids, In Press, http://dx.doi.org/10.1016/j.compfluid.2012.03.023 [2] K. Burrage and J. Erhel, On the performance of various adaptive preconditioned GMRES strategies, 5(1998), 101-121. [3] J. Erhel, K. Burrage and B. Pohl, Restarted GMRES preconditioned by deflation,J. Computational and Applied Mathematics, 69(1996), 303-318.

Constructor & Destructor Documentation

§ DGMRES() [1/2]

template<typename _MatrixType, typename _Preconditioner>
Eigen::DGMRES< _MatrixType, _Preconditioner >::DGMRES ( )
inline

Default constructor.

§ DGMRES() [2/2]

template<typename _MatrixType, typename _Preconditioner>
template<typename MatrixDerived >
Eigen::DGMRES< _MatrixType, _Preconditioner >::DGMRES ( 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

§ dgmres()

template<typename _MatrixType , typename _Preconditioner >
template<typename Rhs , typename Dest >
void Eigen::DGMRES< _MatrixType, _Preconditioner >::dgmres ( const MatrixType &  mat,
const Rhs &  rhs,
Dest &  x,
const Preconditioner &  precond 
) const
protected

Perform several cycles of restarted GMRES with modified Gram Schmidt,.

A right preconditioner is used combined with deflation.

§ dgmresCycle()

template<typename _MatrixType , typename _Preconditioner >
template<typename Dest >
int Eigen::DGMRES< _MatrixType, _Preconditioner >::dgmresCycle ( const MatrixType &  mat,
const Preconditioner &  precond,
Dest &  x,
DenseVector r0,
RealScalar &  beta,
const RealScalar &  normRhs,
int &  nbIts 
) const
protected

Perform one restart cycle of DGMRES.

Parameters
matThe coefficient matrix
precondThe preconditioner
xthe new approximated solution
r0The initial residual vector
betaThe norm of the residual computed so far
normRhsThe norm of the right hand side vector
nbItsThe number of iterations

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