So-Bogus
A c++ sparse block matrix library aimed at Second Order cone problems
|
Preconditionned Krylov Solvers. More...
#include <Krylov.hpp>
Public Types | |
typedef BlockSolverBase < BlockMatrixType > | Base |
typedef PreconditionerType < BlockObjectBase < BlockMatrixType > > | PreconditionerImplType |
typedef Base::GlobalProblemTraits | GlobalProblemTraits |
typedef GlobalProblemTraits::Scalar | Scalar |
typedef krylov::solvers::CG < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | CGType |
typedef krylov::solvers::BiCG < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | BiCGType |
typedef krylov::solvers::BiCGSTAB < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | BiCGSTABType |
typedef krylov::solvers::CGS < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | CGSType |
typedef krylov::solvers::GMRES < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | GMRESType |
typedef krylov::solvers::TFQMR < BlockMatrixType, PreconditionerType < BlockObjectBase < BlockMatrixType > >, GlobalProblemTraits > | TFQMRType |
typedef BlockMatrixTraits < BlockMatrixType > | BlockTraits |
typedef Signal< unsigned, Scalar > | CallBackType |
Public Member Functions | |
Krylov () | |
Default constructor – you will have to call setMatrix() before using any of the solve() functions. | |
Krylov (const BlockObjectBase< BlockMatrixType > &matrix) | |
Constructor with the system matrix – initializes preconditioner. | |
Krylov & | setMatrix (const BlockObjectBase< BlockMatrixType > &matrix) |
Sets the system matrix and initializes the preconditioner. | |
CGType | asCG () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_CG (const RhsT &b, ResT &x) const |
BiCGType | asBiCG () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_BiCG (const RhsT &b, ResT &x) const |
BiCGSTABType | asBiCGSTAB () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_BiCGSTAB (const RhsT &b, ResT &x) const |
CGSType | asCGS () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_CGS (const RhsT &b, ResT &x) const |
GMRESType | asGMRES () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_GMRES (const RhsT &b, ResT &x) const |
TFQMRType | asTFQMR () const |
template<typename RhsT , typename ResT > | |
Scalar | solve_TFQMR (const RhsT &b, ResT &x) const |
template<typename RhsT , typename ResT > | |
Scalar | solve (const RhsT &b, ResT &x, krylov::Method method=krylov::CG) const |
Solve function that takes the method to use as an argument. | |
const PreconditionerImplType & | preconditioner () const |
PreconditionerImplType & | preconditioner () |
void | setMaxIters (unsigned maxIters) |
For iterative solvers: sets the maximum number of iterations. | |
unsigned | maxIters () const |
void | setTol (Scalar tol) |
For iterative solvers: sets the solver tolerance. | |
Scalar | tol () const |
CallBackType & | callback () |
Callback hook; will be triggered every N iterations, depending on the solver. More... | |
const CallBackType & | callback () const |
const BlockObjectBase < BlockMatrixType > & | matrix () const |
Protected Attributes | |
PreconditionerImplType | m_preconditioner |
const BlockObjectBase < BlockMatrixType > * | m_matrix |
Pointer to the matrix of the system. | |
unsigned | m_maxIters |
See setMaxIters() | |
Scalar | m_tol |
See setTol() | |
CallBackType | m_callback |
Preconditionned Krylov Solvers.
BlockMatrixT | The type of system matrix, which should be a subclass of BlockObjectBase |
PreconditionerType | The preconditioner type. It should accept BlockMatrixT as a template parameter. The default value, TrivialPreconditioner, means that no preconditioning will be done. |
|
inherited |
Callback hook; will be triggered every N iterations, depending on the solver.
Useful to monitor the convergence of the solver. Can be connected to a function that takes an unsigned
and a Scalar
as parameters. The first argument will be the current iteration number, and the second the current residual.