All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
NetworKit::ConjugateGradient< Matrix, Preconditioner > Class Template Reference

Implementation of Conjugate Gradient. More...

#include <ConjugateGradient.h>

Public Member Functions

 ConjugateGradient (double tolerance=1e-5)
 
void setup (const Matrix &matrix)
 Sets the solver up for the specified matrix. More...
 
void setupConnected (const Matrix &matrix)
 Sets the solver up for the specified matrix where the underlying graph has to be connected. More...
 
SolverStatus solve (const Vector &rhs, Vector &result, count maxConvergenceTime=5 *60 *1000, count maxIterations=std::numeric_limits< count >::max())
 Solves the linear system $Ax = b$ using the conjugate gradient method with a given preconditioner and with initial value $(0, \dots, 0)^T$. More...
 
void parallelSolve (const std::vector< Vector > &rhs, std::vector< Vector > &results, count maxConvergenceTime=5 *60 *1000, count maxIterations=std::numeric_limits< count >::max())
 Solves the linear systems in parallel. More...
 
- Public Member Functions inherited from NetworKit::LinearSolver< Matrix >
 LinearSolver (const double tolerance)
 Construct an abstract solver with the given tolerance. More...
 
virtual ~LinearSolver ()=default
 
virtual void setup (const Graph &graph)
 Sets the solver up for the Laplacian matrix of the graph specified. More...
 
virtual void setupConnected (const Graph &graph)
 Sets the solver up for the Laplacian matrix of the graph specified. More...
 

Additional Inherited Members

- Protected Attributes inherited from NetworKit::LinearSolver< Matrix >
double tolerance
 

Detailed Description

template<class Matrix, class Preconditioner>
class NetworKit::ConjugateGradient< Matrix, Preconditioner >

Implementation of Conjugate Gradient.

Constructor & Destructor Documentation

template<class Matrix , class Preconditioner >
NetworKit::ConjugateGradient< Matrix, Preconditioner >::ConjugateGradient ( double  tolerance = 1e-5)
inline

Member Function Documentation

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

Solves the linear systems in parallel.

Parameters
rhs
results
maxConvergenceTime
maxIterations

Reimplemented from NetworKit::LinearSolver< Matrix >.

template<class Matrix , class Preconditioner >
void NetworKit::ConjugateGradient< Matrix, Preconditioner >::setup ( const Matrix matrix)
inlinevirtual

Sets the solver up for the specified matrix.

Parameters
matrix

Implements NetworKit::LinearSolver< Matrix >.

template<class Matrix , class Preconditioner >
void NetworKit::ConjugateGradient< Matrix, Preconditioner >::setupConnected ( const Matrix matrix)
inlinevirtual

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

Parameters
matrix

Implements NetworKit::LinearSolver< Matrix >.

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

Solves the linear system $Ax = b$ using the conjugate gradient method with a given preconditioner and with initial value $(0, \dots, 0)^T$.

We the return the solution $x$. The solution $x$ fulfils $\frac{\Vert Ax - b\Vert}{\Vert b \Vert} \leq relative\_residual$ if the algorithm has converged.

Obviously, A needs to have the same number of rows as b and status.residual must be nonnegative. You may also request that the algorithm does not run for more than status.max_iters iterations.

Implements NetworKit::LinearSolver< Matrix >.


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