All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
NetworKit::LinearSolver< Matrix > Class Template Referenceabstract

Abstract base class for solvers that solve linear systems. More...

#include <LinearSolver.h>

Public Member Functions

 LinearSolver (const double tolerance)
 Construct an abstract solver with the given tolerance. More...
 
virtual ~LinearSolver ()=default
 
virtual void setup (const Matrix &matrix)=0
 Sets the solver up for the specified matrix. More...
 
virtual void setup (const Graph &graph)
 Sets the solver up for the Laplacian matrix of the graph specified. More...
 
virtual void setupConnected (const Matrix &matrix)=0
 Sets the solver up for the specified matrix where the underlying graph has to be connected. More...
 
virtual void setupConnected (const Graph &graph)
 Sets the solver up for the Laplacian matrix of the graph specified. More...
 
virtual SolverStatus solve (const Vector &rhs, Vector &result, count maxConvergenceTime=5 *60 *1000, count maxIterations=std::numeric_limits< count >::max())=0
 Abstract solve function that computes result for the given right-hand side rhs and the matrix that has been setup in setup. More...
 
virtual void parallelSolve (const std::vector< Vector > &rhs, std::vector< Vector > &results, count maxConvergenceTime=5 *60 *1000, count maxIterations=std::numeric_limits< count >::max())
 Abstract parallel solve function that computes the results for the matrix currently setup and the right-hand sides rhs. More...
 

Protected Attributes

double tolerance
 

Detailed Description

template<class Matrix>
class NetworKit::LinearSolver< Matrix >

Abstract base class for solvers that solve linear systems.

Constructor & Destructor Documentation

template<class Matrix>
NetworKit::LinearSolver< Matrix >::LinearSolver ( const double  tolerance)
inline

Construct an abstract solver with the given tolerance.

The relative residual ||Ax-b||/||b|| should be less than or equal to tolerance after the solver finished.

Parameters
tolerance
template<class Matrix>
virtual NetworKit::LinearSolver< Matrix >::~LinearSolver ( )
virtualdefault

Member Function Documentation

template<class Matrix >
void NetworKit::LinearSolver< Matrix >::parallelSolve ( const std::vector< Vector > &  rhs,
std::vector< Vector > &  results,
count  maxConvergenceTime = 5 * 60 * 1000,
count  maxIterations = std::numeric_limits<count>::max() 
)
virtual

Abstract parallel solve function that computes the results for the matrix currently setup and the right-hand sides rhs.

The maximum spent time for each system can be specified by maxConvergenceTime and the maximum number of iterations can be set by maxIterations.

Parameters
rhs
results
maxConvergenceTime
maxIterations
Note
If the solver does not support parallelism during solves, this function falls back to solving the systems sequentially.

Reimplemented in NetworKit::Lamg< Matrix >, NetworKit::Lamg< NetworKit::CSRMatrix >, and NetworKit::ConjugateGradient< Matrix, Preconditioner >.

template<class Matrix>
virtual void NetworKit::LinearSolver< Matrix >::setup ( const Matrix matrix)
pure virtual

Sets the solver up for the specified matrix.

Parameters
matrix

Implemented in NetworKit::Lamg< Matrix >, NetworKit::Lamg< NetworKit::CSRMatrix >, and NetworKit::ConjugateGradient< Matrix, Preconditioner >.

template<class Matrix>
void NetworKit::LinearSolver< Matrix >::setup ( const Graph graph)
virtual

Sets the solver up for the Laplacian matrix of the graph specified.

Parameters
graph
template<class Matrix>
virtual void NetworKit::LinearSolver< Matrix >::setupConnected ( const Matrix matrix)
pure virtual

Sets the solver up for the specified matrix where the underlying graph has to be connected.

Parameters
matrix

Implemented in NetworKit::Lamg< Matrix >, NetworKit::Lamg< NetworKit::CSRMatrix >, and NetworKit::ConjugateGradient< Matrix, Preconditioner >.

template<class Matrix>
void NetworKit::LinearSolver< Matrix >::setupConnected ( const Graph graph)
virtual

Sets the solver up for the Laplacian matrix of the graph specified.

The graph has to be connected.

Parameters
graph
template<class Matrix>
virtual SolverStatus NetworKit::LinearSolver< Matrix >::solve ( const Vector rhs,
Vector result,
count  maxConvergenceTime = 5 *60 *1000,
count  maxIterations = std::numeric_limits< count >::max() 
)
pure virtual

Abstract solve function that computes result for the given right-hand side rhs and the matrix that has been setup in setup.

Parameters
rhs
result
maxConvergenceTime
maxIterations
Returns
A SolverStatus object which provides some statistics like the final absolute residual.

Implemented in NetworKit::Lamg< Matrix >, NetworKit::Lamg< NetworKit::CSRMatrix >, and NetworKit::ConjugateGradient< Matrix, Preconditioner >.

Member Data Documentation

template<class Matrix>
double NetworKit::LinearSolver< Matrix >::tolerance
protected

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