LAMA
lama::LUSolver Class Reference

#include <LUSolver.hpp>

Inheritance diagram for lama::LUSolver:

Data Structures

struct  lama_gemm
struct  lama_swap
struct  LUSolverRuntime

Public Member Functions

 LUSolver (const std::string &id)
 Creates a solver with a given ID.
 LUSolver (const std::string &id, LoggerPtr logger)
 Create a gaussian solver with a given ID and a given logger.
 LUSolver (const LUSolver &other)
 Copy constructor that copies the status independent solver information.
virtual ~LUSolver ()
 LUSolver destructor.
virtual void initialize (const Matrix &coefficients)
 Used to initialize a gaussian solver with a certain matrix A from A*u=f.
void factorMatrixToLU (Matrix &matrix, std::vector< IndexType > &permutation)
virtual void solve (Vector &solution, const Vector &rhs)
 Solves the equation system based on the given rhs.
void setTileSize (const IndexType tilesize)
IndexType getTileSize ()
virtual void setDeviceNumber (const IndexType dev)
virtual IndexType getDeviceNumber ()
virtual LUSolverRuntimegetRuntime ()
 Returns the complete configuration of the derived class.
virtual const LUSolverRuntimegetConstRuntime () const
 Returns the complete const configuration of the derived class.
virtual SolverPtr copy ()
 Copies the status independent solver informations to create a new instance of the same type.
virtual void solveInit (Vector &solution, const Vector &rhs)
 Initializes the solver with rhs and solution.
virtual void solveImpl ()=0
 Solves the equation system.
virtual void solveFinalize ()
 Finalizes the solving process.
const std::string & getId () const
 Returns the ID of this solver.
const VectorgetResidual () const
 Contingently calculates the current residual based on the coefficients, rhs and solution currently associated with this.
const MatrixgetCoefficients () const
 Gets the matrix A from A*u=f.
void setLogger (LoggerPtr logger)
 Redefines mLogger.
void setLogLevel (LogLevel::LogLevel level)
 Switches the loglevel of mLogger.
virtual void setContext (ContextPtr context)
 Sets the context where this solver should be executed.

Protected Member Functions

virtual void writeAt (std::ostream &stream) const
 Overrides Printable::writeAt with more useful stuff.

Protected Attributes

LUSolverRuntime mLUSolverRuntime
IndexType mTilesize
IndexType mDev
std::string mId
 The ID of this solver.
LoggerPtr mLogger
 The solver logger.
ContextPtr mContext
 For forcing the context solver dependent.

Static Protected Attributes

static const double epsilon = 1 + 1E-06

Private Member Functions

template<typename T >
void computeLUFactorization (DenseMatrix< T > &matrix, std::vector< IndexType > &permutation)
template<typename T >
void pgetf2 (const IndexType numBlockRows, DenseStorage< T > **const A, IndexType *const ipiv, const PartitionId ROOT)
template<typename T >
void plaswp (DenseStorage< T > **const A, const PartitionId ROOT, const IndexType *const ipiv, const IndexType n, const lama_swap< T > swap)
template<typename T >
IndexType piamax_own (const IndexType numBlockCol, DenseStorage< T > **const local, const IndexType col, const IndexType locRow=0)
template<typename T >
void ptrsm (const enum CBLAS_UPLO uplo, const DenseMatrix< T > &matrix, DenseVector< T > &solution)
IndexType computeTilesize (IndexType m, IndexType n)
void initializeCommunicator ()
 LAMA_LOG_DECL_STATIC_LOGGER (logger)

Private Attributes

CommunicatorPtr mComm

Constructor & Destructor Documentation

lama::LUSolver::LUSolver ( const std::string &  id)

Creates a solver with a given ID.

Parameters:
idThe ID for the solver.

Referenced by copy().

lama::LUSolver::LUSolver ( const std::string &  id,
LoggerPtr  logger 
)

Create a gaussian solver with a given ID and a given logger.

Parameters:
idThe ID of the solver.
loggerThe logger which shall be used by the solver
lama::LUSolver::LUSolver ( const LUSolver other)

Copy constructor that copies the status independent solver information.

LUSolver destructor.


Member Function Documentation

template<typename T >
void lama::LUSolver::computeLUFactorization ( DenseMatrix< T > &  matrix,
std::vector< IndexType > &  permutation 
) [private]

Copies the status independent solver informations to create a new instance of the same type.

Returns:
shared pointer of the copied solver

Implements lama::Solver.

References LUSolver().

Referenced by ptrsm().

void lama::LUSolver::factorMatrixToLU ( Matrix matrix,
std::vector< IndexType > &  permutation 
)
const Matrix & lama::Solver::getCoefficients ( ) const [inherited]

Gets the matrix A from A*u=f.

Returns:
The coefficient matrix A.

References lama::Solver::getConstRuntime(), LAMA_ASSERT_DEBUG, and lama::Solver::SolverRuntime::mCoefficients.

Referenced by lama::InverseSolver::invert(), and piamax_own().

Returns the complete const configuration of the derived class.

Implements lama::Solver.

References mLUSolverRuntime.

References mDev.

const std::string & lama::Solver::getId ( ) const [inherited]

Returns the ID of this solver.

Returns:
The ID of this solver.

References lama::Solver::mId.

Referenced by lama::IterativeSolver::criteriaAreSatisfied(), lama::IterativeSolver::solveImpl(), and lama::SolverConfigGrammar::SolverConfigGrammar().

Returns the complete configuration of the derived class.

Implements lama::Solver.

References mLUSolverRuntime.

Referenced by initialize(), and solve().

void lama::LUSolver::initialize ( const Matrix coefficients) [virtual]

Used to initialize a gaussian solver with a certain matrix A from A*u=f.

This method initializes a gaussian solver with a certain coefficient- matrix. The given matrix will be overwritten by its lu-factorization.

Parameters:
coefficientsThe matrix A from A*u=f.

Reimplemented from lama::Solver.

References computeLUFactorization(), lama::Matrix::getNumRows(), getRuntime(), LAMA_REGION, lama::LUSolver::LUSolverRuntime::mLUfactorization, and lama::LUSolver::LUSolverRuntime::mPermutation.

Reimplemented from lama::Solver.

template<typename T >
void lama::LUSolver::plaswp ( DenseStorage< T > **const  A,
const PartitionId  ROOT,
const IndexType *const  ipiv,
const IndexType  n,
const lama_swap< T >  swap 
) [private]
void lama::Solver::setContext ( ContextPtr  context) [virtual, inherited]

Sets the context where this solver should be executed.

Sets the context where this solver should be executed. Caution: This overrides the context of the coefficients matrix A from A * u = f used to inializ this solver.

Parameters:
[in]contextthe context where this solver should be executed.

Reimplemented in lama::InverseSolver.

References lama::Solver::mContext.

Referenced by lama::GMRES::initialize().

void lama::LUSolver::setDeviceNumber ( const IndexType  dev) [virtual]

References mDev.

void lama::Solver::setLogger ( LoggerPtr  logger) [inherited]

Redefines mLogger.

References lama::Solver::mLogger.

void lama::Solver::setLogLevel ( LogLevel::LogLevel  level) [inherited]

Switches the loglevel of mLogger.

Returns:

References lama::Solver::mLogger.

void lama::LUSolver::setTileSize ( const IndexType  tilesize)

References mTilesize.

void lama::LUSolver::solve ( Vector solution,
const Vector rhs 
) [virtual]

Solves the equation system based on the given rhs.

The matrix A from A*u=f has to be initialized first! (call gaussianSolver::initialize(matrix) for example). This method uses the lu-factorization, computed in LUSolver::initialize( matrix ), to calculate the solution using forwards and backwards application.

Parameters:
rhsThe right hand side of A*u=f.
solutionThe solution from A*u=f. Mostly used as starting solution for an IterativeSolver.

Reimplemented from lama::Solver.

References lama::CblasLower, lama::CblasNonUnit, lama::CblasNoTrans, lama::CblasRowMajor, lama::CblasUnit, lama::CblasUpper, lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), lama::DenseVector< T >::getLocalValues(), lama::Matrix::getNumColumns(), lama::Distribution::getNumPartitions(), lama::Matrix::getNumRows(), getRuntime(), LAMA_REGION, LAMA_THROWEXCEPTION, lama::LUSolver::LUSolverRuntime::mLUfactorization, lama::LUSolver::LUSolverRuntime::mPermutation, lama::WriteAccess< T >::resize(), and lama::OpenMPLAPACK::trtrs().

void lama::Solver::solveFinalize ( ) [virtual, inherited]

Finalizes the solving process.

Reimplemented in lama::DefaultJacobi, and lama::SpecializedJacobi.

Referenced by lama::Solver::solve().

virtual void lama::Solver::solveImpl ( ) [pure virtual, inherited]

Solves the equation system.

Rhs and starting solution have to be initialized first! (call solveInit( rhs, solution ) ). The solver needs to be initialized first with the matrix from the equation to solve, e.g. A from A*u=f (call solver::initialize(A) for example)

This method solves the equation system by using the given rhs and solution. For most solvers the solution-vector is used as a starting solution for the solve process. This class does not take responsibility for deleting the vectors after the solver! Make sure you do not delete the vectors during the solver process.

Implemented in lama::MetaSolver, lama::IterativeSolver, lama::InverseSolver, and lama::TrivialPreconditioner.

Referenced by lama::Solver::solve().

void lama::Solver::solveInit ( Vector solution,
const Vector rhs 
) [virtual, inherited]
void lama::Solver::writeAt ( std::ostream &  stream) const [protected, virtual, inherited]

Overrides Printable::writeAt with more useful stuff.

Reimplemented from Printable.

References lama::Solver::mId.


Field Documentation

const double lama::LUSolver::epsilon = 1 + 1E-06 [static, protected]

Referenced by pgetf2().

ContextPtr lama::Solver::mContext [protected, inherited]

For forcing the context solver dependent.

If the context for a solver is set, the context of the input matrix will be ignored

Referenced by lama::SpecializedJacobi::iterateTyped(), lama::InverseSolver::setContext(), and lama::Solver::setContext().


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