So-Bogus
A c++ sparse block matrix library aimed at Second Order cone problems
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
bogus::Krylov< BlockMatrixType, PreconditionerType > Class Template Reference

Preconditionned Krylov Solvers. More...

#include <Krylov.hpp>

Inheritance diagram for bogus::Krylov< BlockMatrixType, PreconditionerType >:
bogus::BlockSolverBase< BlockMatrixType >

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.
 
KrylovsetMatrix (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
 
CallBackTypecallback ()
 Callback hook; will be triggered every N iterations, depending on the solver. More...
 
const CallBackTypecallback () 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
 

Detailed Description

template<typename BlockMatrixType, template< typename BlockMatrixT > class PreconditionerType>
class bogus::Krylov< BlockMatrixType, PreconditionerType >

Preconditionned Krylov Solvers.

Template Parameters
BlockMatrixTThe type of system matrix, which should be a subclass of BlockObjectBase
PreconditionerTypeThe preconditioner type. It should accept BlockMatrixT as a template parameter. The default value, TrivialPreconditioner, means that no preconditioning will be done.
See Also
TrivialPreconditioner, DiagonalPreconditioner, DiagonalLUPreconditioner, DiagonalLDLTPreconditioner
krylov

Member Function Documentation

template<typename BlockMatrixType >
CallBackType& bogus::BlockSolverBase< BlockMatrixType >::callback ( )
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.

See Also
Signal< unsigned, Scalar >

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