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.
More...
|
typedef MatrixType_ | MatrixType |
|
typedef MatrixType::Scalar | Scalar |
|
typedef MatrixType::StorageIndex | StorageIndex |
|
typedef MatrixType::RealScalar | RealScalar |
|
typedef Preconditioner_ | Preconditioner |
|
typedef Matrix< Scalar, Dynamic, Dynamic > | DenseMatrix |
|
typedef Matrix< RealScalar, Dynamic, Dynamic > | DenseRealMatrix |
|
typedef Matrix< Scalar, Dynamic, 1 > | DenseVector |
|
typedef Matrix< RealScalar, Dynamic, 1 > | DenseRealVector |
|
typedef Matrix< std::complex< RealScalar >, Dynamic, 1 > | ComplexVector |
|
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 |
|
|
| DGMRES () |
|
template<typename MatrixDerived > |
| DGMRES (const EigenBase< MatrixDerived > &A) |
|
| ~DGMRES () |
|
template<typename Rhs , typename Dest > |
void | _solve_vector_with_guess_impl (const Rhs &b, Dest &x) const |
|
Index | restart () |
|
void | set_restart (const Index restart) |
|
void | setEigenv (const Index neig) |
|
Index | deflSize () |
|
void | setMaxEigenv (const Index maxNeig) |
|
template<typename Rhs , typename Dest > |
void | _solve_impl (const Rhs &b, Dest &x) const |
|
template<typename Rhs , typename DestDerived > |
void | _solve_with_guess_impl (const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const |
|
template<typename Rhs , typename DestDerived > |
std::enable_if_t< Rhs::ColsAtCompileTime !=1 &&DestDerived::ColsAtCompileTime !=1 > | _solve_with_guess_impl (const Rhs &b, MatrixBase< DestDerived > &aDest) const |
|
template<typename Rhs , typename DestDerived > |
std::enable_if_t< Rhs::ColsAtCompileTime==1||DestDerived::ColsAtCompileTime==1 > | _solve_with_guess_impl (const Rhs &b, MatrixBase< DestDerived > &dest) const |
|
| IterativeSolverBase () |
|
| IterativeSolverBase (const EigenBase< MatrixDerived > &A) |
|
| IterativeSolverBase (IterativeSolverBase &&)=default |
|
| ~IterativeSolverBase () |
|
DGMRES< MatrixType_, Preconditioner_ > & | analyzePattern (const EigenBase< MatrixDerived > &A) |
|
DGMRES< MatrixType_, Preconditioner_ > & | factorize (const EigenBase< MatrixDerived > &A) |
|
DGMRES< MatrixType_, Preconditioner_ > & | compute (const EigenBase< MatrixDerived > &A) |
|
EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
|
EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
|
RealScalar | tolerance () const |
|
DGMRES< MatrixType_, Preconditioner_ > & | setTolerance (const RealScalar &tolerance) |
|
Preconditioner & | preconditioner () |
|
const Preconditioner & | preconditioner () const |
|
Index | maxIterations () const |
|
DGMRES< MatrixType_, Preconditioner_ > & | setMaxIterations (Index maxIters) |
|
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_with_guess_impl (const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const |
|
std::enable_if_t< Rhs::ColsAtCompileTime !=1 &&DestDerived::ColsAtCompileTime !=1 > | _solve_with_guess_impl (const Rhs &b, MatrixBase< DestDerived > &aDest) const |
|
std::enable_if_t< Rhs::ColsAtCompileTime==1||DestDerived::ColsAtCompileTime==1 > | _solve_with_guess_impl (const Rhs &b, MatrixBase< DestDerived > &dest) const |
|
void | _solve_impl (const Rhs &b, Dest &x) const |
|
DGMRES< MatrixType_, Preconditioner_ > & | derived () |
|
const DGMRES< MatrixType_, Preconditioner_ > & | derived () const |
|
| SparseSolverBase () |
|
| SparseSolverBase (SparseSolverBase &&other) |
|
| ~SparseSolverBase () |
|
Derived & | derived () |
|
const Derived & | derived () const |
|
template<typename Rhs > |
const Solve< Derived, Rhs > | solve (const MatrixBase< Rhs > &b) const |
|
template<typename Rhs > |
const Solve< Derived, Rhs > | solve (const SparseMatrixBase< Rhs > &b) const |
|
template<typename Rhs , typename Dest > |
void | _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const |
|
|
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 > |
Index | dgmresCycle (const MatrixType &mat, const Preconditioner &precond, Dest &x, DenseVector &r0, RealScalar &beta, const RealScalar &normRhs, Index &nbIts) const |
| Perform one restart cycle of DGMRES. More...
|
|
Index | dgmresComputeDeflationData (const MatrixType &mat, const Preconditioner &precond, const Index &it, StorageIndex &neig) const |
|
template<typename RhsType , typename DestType > |
Index | 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 |
|
void | init () |
|
const ActualMatrixType & | matrix () const |
|
void | grab (const InputType &A) |
|
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
-
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 Typical usage :
DGMRES<SparseMatrix<double> > solver;
BiCGSTAB< SparseMatrix< double > > solver Definition: BiCGSTAB_simple.cpp:5
Scalar * b Definition: benchVecAdd.cpp:17
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A Definition: bench_gemm.cpp:47
list x Definition: plotDoE.py:28
|
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, https://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.
template<typename MatrixType_ , typename Preconditioner_ >
template<typename Rhs , typename Dest >
Perform several cycles of restarted GMRES with modified Gram Schmidt,.
A right preconditioner is used combined with deflation.
237 if (normRhs <= considerAsZero) {
252 if (
x.squaredNorm() == 0)
x = precond.solve(rhs);
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
Index dgmresCycle(const MatrixType &mat, const Preconditioner &precond, Dest &x, DenseVector &r0, RealScalar &beta, const RealScalar &normRhs, Index &nbIts) const
Perform one restart cycle of DGMRES.
Definition: DGMRES.h:286
DenseMatrix m_H
Definition: DGMRES.h:206
DenseMatrix m_V
Definition: DGMRES.h:205
DenseMatrix m_Hes
Definition: DGMRES.h:207
RealScalar m_tolerance
Definition: IterativeSolverBase.h:385
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
Index rows() const
Definition: SparseMatrix.h:159
#define min(a, b)
Definition: datatypes.h:22
Scalar beta
Definition: level2_cplx_impl.h:36
References beta, min, n, Eigen::NoConvergence, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::rows(), Eigen::Success, and plotDoE::x.
Referenced by Eigen::DGMRES< MatrixType_, Preconditioner_ >::_solve_vector_with_guess_impl().
template<typename MatrixType_ , typename Preconditioner_ >
template<typename Dest >
Perform one restart cycle of DGMRES.
- Parameters
-
mat | The coefficient matrix |
precond | The preconditioner |
x | the new approximated solution |
r0 | The initial residual vector |
beta | The norm of the residual computed so far |
normRhs | The norm of the right hand side vector |
nbIts | The number of iterations |
295 std::vector<JacobiRotation<Scalar> > gr(
m_restart);
303 tv2 = precond.solve(tv1);
305 tv2 = precond.solve(
m_V.col(it));
313 tv1 = tv1 - coef *
m_V.col(
i);
319 m_V.col(it + 1) = tv1 / coef;
320 m_H(it + 1, it) = coef;
330 gr[it].makeGivens(
m_H(it, it),
m_H(it + 1, it));
332 m_H.col(it).applyOnTheLeft(it, it + 1, gr[it].
adjoint());
333 g.applyOnTheLeft(it, it + 1, gr[it].
adjoint());
352 nrs =
m_H.topLeftCorner(it, it).template triangularView<Upper>().solve(g.head(it));
356 tv1 =
m_V.leftCols(it) * nrs;
358 x =
x + precond.solve(tv2);
360 x =
x + precond.solve(
m_V.leftCols(it) * nrs);
363 if (nbIts < m_iterations && m_info == NoConvergence && m_neig > 0 && (
m_r +
m_neig) <
m_maxNeig)
int i
Definition: BiCGSTAB_step_by_step.cpp:9
void adjoint(const MatrixType &m)
Definition: adjoint.cpp:85
Index dgmresApplyDeflation(const RhsType &In, DestType &Out) const
Definition: DGMRES.h:484
MatrixType::Scalar Scalar
Definition: DGMRES.h:111
Index dgmresComputeDeflationData(const MatrixType &mat, const Preconditioner &precond, const Index &it, StorageIndex &neig) const
Definition: DGMRES.h:405
Scalar dot(const MatrixBase< OtherDerived > &other) const
References abs(), adjoint(), beta, i, n, Eigen::NoConvergence, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::rows(), Eigen::PlainObjectBase< Derived >::setZero(), Eigen::Success, and plotDoE::x.