|
MOAB
4.9.3pre
|
A preconditioner based on the digonal entries. More...
#include <BasicPreconditioners.h>


Public Types | |
| enum | { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic } |
| typedef Vector::StorageIndex | StorageIndex |
Public Member Functions | |
| DiagonalPreconditioner () | |
| template<typename MatType > | |
| DiagonalPreconditioner (const MatType &mat) | |
| Index | rows () const |
| Index | cols () const |
| template<typename MatType > | |
| DiagonalPreconditioner & | analyzePattern (const MatType &) |
| template<typename MatType > | |
| DiagonalPreconditioner & | factorize (const MatType &mat) |
| template<typename MatType > | |
| DiagonalPreconditioner & | compute (const MatType &mat) |
| template<typename Rhs , typename Dest > | |
| void | _solve_impl (const Rhs &b, Dest &x) const |
| template<typename Rhs > | |
| const Solve < DiagonalPreconditioner, Rhs > | solve (const MatrixBase< Rhs > &b) const |
| ComputationInfo | info () |
Protected Attributes | |
| Vector | m_invdiag |
| bool | m_isInitialized |
Private Types | |
| typedef _Scalar | Scalar |
| typedef Matrix< Scalar, Dynamic, 1 > | Vector |
A preconditioner based on the digonal entries.
This class allows to approximately solve for A.x = b problems assuming A is a diagonal matrix. In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for:
A.diagonal().asDiagonal() . x = b
| _Scalar | the type of the scalar. |
This preconditioner is suitable for both selfadjoint and general problems. The diagonal entries are pre-inverted and stored into a dense vector.
Definition at line 36 of file BasicPreconditioners.h.
typedef _Scalar Eigen::DiagonalPreconditioner< _Scalar >::Scalar [private] |
Reimplemented in Eigen::LeastSquareDiagonalPreconditioner< _Scalar >.
Definition at line 38 of file BasicPreconditioners.h.
| typedef Vector::StorageIndex Eigen::DiagonalPreconditioner< _Scalar >::StorageIndex |
Definition at line 41 of file BasicPreconditioners.h.
typedef Matrix<Scalar,Dynamic,1> Eigen::DiagonalPreconditioner< _Scalar >::Vector [private] |
Definition at line 39 of file BasicPreconditioners.h.
| anonymous enum |
Definition at line 42 of file BasicPreconditioners.h.
{
ColsAtCompileTime = Dynamic,
MaxColsAtCompileTime = Dynamic
};
| Eigen::DiagonalPreconditioner< _Scalar >::DiagonalPreconditioner | ( | ) | [inline] |
Definition at line 47 of file BasicPreconditioners.h.
: m_isInitialized(false) {}
| Eigen::DiagonalPreconditioner< _Scalar >::DiagonalPreconditioner | ( | const MatType & | mat | ) | [inline, explicit] |
Definition at line 50 of file BasicPreconditioners.h.
| void Eigen::DiagonalPreconditioner< _Scalar >::_solve_impl | ( | const Rhs & | b, |
| Dest & | x | ||
| ) | const [inline] |
Definition at line 89 of file BasicPreconditioners.h.
{
x = m_invdiag.array() * b.array() ;
}
| DiagonalPreconditioner& Eigen::DiagonalPreconditioner< _Scalar >::analyzePattern | ( | const MatType & | ) | [inline] |
Reimplemented in Eigen::LeastSquareDiagonalPreconditioner< _Scalar >.
Definition at line 59 of file BasicPreconditioners.h.
{
return *this;
}
| Index Eigen::DiagonalPreconditioner< _Scalar >::cols | ( | void | ) | const [inline] |
Definition at line 56 of file BasicPreconditioners.h.
{ return m_invdiag.size(); }
| DiagonalPreconditioner& Eigen::DiagonalPreconditioner< _Scalar >::compute | ( | const MatType & | mat | ) | [inline] |
Reimplemented in Eigen::LeastSquareDiagonalPreconditioner< _Scalar >.
Definition at line 82 of file BasicPreconditioners.h.
{
return factorize(mat);
}
| DiagonalPreconditioner& Eigen::DiagonalPreconditioner< _Scalar >::factorize | ( | const MatType & | mat | ) | [inline] |
Reimplemented in Eigen::LeastSquareDiagonalPreconditioner< _Scalar >.
Definition at line 65 of file BasicPreconditioners.h.
{
m_invdiag.resize(mat.cols());
for(int j=0; j<mat.outerSize(); ++j)
{
typename MatType::InnerIterator it(mat,j);
while(it && it.index()!=j) ++it;
if(it && it.index()==j && it.value()!=Scalar(0))
m_invdiag(j) = Scalar(1)/it.value();
else
m_invdiag(j) = Scalar(1);
}
m_isInitialized = true;
return *this;
}
| ComputationInfo Eigen::DiagonalPreconditioner< _Scalar >::info | ( | ) | [inline] |
Reimplemented in Eigen::LeastSquareDiagonalPreconditioner< _Scalar >.
Definition at line 103 of file BasicPreconditioners.h.
{ return Success; }
| Index Eigen::DiagonalPreconditioner< _Scalar >::rows | ( | void | ) | const [inline] |
Definition at line 55 of file BasicPreconditioners.h.
{ return m_invdiag.size(); }
| const Solve<DiagonalPreconditioner, Rhs> Eigen::DiagonalPreconditioner< _Scalar >::solve | ( | const MatrixBase< Rhs > & | b | ) | const [inline] |
Definition at line 95 of file BasicPreconditioners.h.
{
eigen_assert(m_isInitialized && "DiagonalPreconditioner is not initialized.");
eigen_assert(m_invdiag.size()==b.rows()
&& "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b");
return Solve<DiagonalPreconditioner, Rhs>(*this, b.derived());
}
Vector Eigen::DiagonalPreconditioner< _Scalar >::m_invdiag [protected] |
Definition at line 106 of file BasicPreconditioners.h.
bool Eigen::DiagonalPreconditioner< _Scalar >::m_isInitialized [protected] |
Definition at line 107 of file BasicPreconditioners.h.