TBCI Numerical high perf. C++ Library 2.8.0
cg.h File Reference

The iterative Vector equation solver TBCI::CG. More...

#include "tbci/basics.h"
#include "tbci/solver/precond.h"
Include dependency graph for cg.h:

Go to the source code of this file.

Functions

NAMESPACE_TBCI INST3 (template< typename T, Matrix< T >, Vector< T > > class NN friend int CG(const Matrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, Matrix< T > > &, unsigned int &, double &);) INST3(template< typename T
NAMESPACE_TBCI Vector< T > class NN friend int CG (const BdMatrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, BdMatrix< T > > &, unsigned int &, double &)
template<typename T, typename SysMatrix, typename SysVector>
int CG (const SysMatrix &A, SysVector &x, const SysVector &b, const Preconditioner_Sig< T, SysMatrix > &M, unsigned int &max_iter, double &tol)
 Iterative template solver routine – CG.
 INST3 (template< typename T, Matrix< T >, Vector< T > > class NN friend int CG2(const Matrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, Matrix< T > > &, unsigned int &, double &);) INST3(template< typename T
Vector< T > class NN friend int CG2 (const BdMatrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, BdMatrix< T > > &, unsigned int &, double &)
template<typename T, typename SysMatrix, typename SysVector>
int CG2 (const SysMatrix &A, SysVector &x, const SysVector &b, const Preconditioner_Sig< T, SysMatrix > &M, unsigned int &max_iter, double &tol)
 CG2 solves the symmetric complex (positive definite?) linear system Ax=b using the Conjugate Gradient method.

Variables

NAMESPACE_TBCI BdMatrix< T >

Detailed Description

The iterative Vector equation solver TBCI::CG.

Definition in file cg.h.

Function Documentation

◆ CG() [1/2]

NAMESPACE_TBCI Vector< T > class NN friend int CG ( const BdMatrix< T > & ,
Vector< T > & ,
const Vector< T > & ,
const Preconditioner_Sig< T, BdMatrix< T > > & ,
unsigned int & ,
double &  )

References CG(), and T.

Referenced by CG(), and CG().

◆ CG() [2/2]

template<typename T, typename SysMatrix, typename SysVector>
int CG ( const SysMatrix & A,
SysVector & x,
const SysVector & b,
const Preconditioner_Sig< T, SysMatrix > & M,
unsigned int & max_iter,
double & tol )

Iterative template solver routine – CG.

CG solves the symmetric positive definite linear system Ax=b using the Conjugate Gradient method.

CG follows the algorithm described on p. 15 in the SIAM Templates book.

Returns
The return value indicates convergence within max_iter (input) iterations (0), or no convergence within max_iter iterations (1).

Upon successful return, output arguments have the following values:

Parameters
x– approximate solution to Ax = b
max_iter– the number of iterations performed before the tolerance was reached
tol– the residual after the final iteration

Definition at line 45 of file cg.h.

References b, CG(), dot(), i, p, Preconditioner_Sig< T, MatrixType >::solve(), SysMatrix, and x.

◆ CG2() [1/2]

Vector< T > class NN friend int CG2 ( const BdMatrix< T > & ,
Vector< T > & ,
const Vector< T > & ,
const Preconditioner_Sig< T, BdMatrix< T > > & ,
unsigned int & ,
double &  )

References CG2(), and T.

Referenced by CG2(), and INST3().

◆ CG2() [2/2]

template<typename T, typename SysMatrix, typename SysVector>
int CG2 ( const SysMatrix & A,
SysVector & x,
const SysVector & b,
const Preconditioner_Sig< T, SysMatrix > & M,
unsigned int & max_iter,
double & tol )

CG2 solves the symmetric complex (positive definite?) linear system Ax=b using the Conjugate Gradient method.

Definition at line 112 of file cg.h.

References b, i, p, Preconditioner_Sig< T, MatrixType >::solve(), SysMatrix, and x.

◆ INST3() [1/2]

NAMESPACE_TBCI INST3 ( template< typename T, Matrix< T >, Vector< T > > class NN friend int CG(const Matrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, Matrix< T > > &, unsigned int &, double &); )

◆ INST3() [2/2]

INST3 ( template< typename T, Matrix< T >, Vector< T > > class NN friend int CG2(const Matrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, Matrix< T > > &, unsigned int &, double &); )

References CG2(), and T.

Variable Documentation

◆ BdMatrix< T >

BdMatrix< T >

Definition at line 16 of file cg.h.