NUMCXX  0.13.20181108
Numerical library for small projects and teaching purposes
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
numcxx::TPreconJacobi< T > Class Template Reference

Description

template<typename T>
class numcxx::TPreconJacobi< T >

Jacobi preconditioner class.

Definition at line 16 of file tprecon-jacobi.hxx.

+ Inheritance diagram for numcxx::TPreconJacobi< T >:
+ Collaboration diagram for numcxx::TPreconJacobi< T >:

Public Member Functions

 TPreconJacobi (const std::shared_ptr< TSparseMatrix< T >> pA)
 Create Preconditioner. More...
 
 TPreconJacobi (TSparseMatrix< T > &A)
 
 ~TPreconJacobi ()
 
void update (TSparseMatrix< T > &A)
 Perform actual computation preconditioner. More...
 
void solve (TArray< T > &Sol, const TArray< T > &Rhs) const
 Solve preconditioning system. More...
 
virtual void update (void)
 

Static Public Member Functions

static std::shared_ptr< TPreconJacobi< T > > create (const std::shared_ptr< TSparseMatrix< T >> pA)
 Create preconditioner. More...
 

Public Attributes

std::shared_ptr< TArray1< T > > pInvDiag
 

Constructor & Destructor Documentation

template<typename T >
numcxx::TPreconJacobi< T >::TPreconJacobi ( const std::shared_ptr< TSparseMatrix< T >>  pA)
inline

Create Preconditioner.

Create LU factorization class.

Definition at line 7 of file tprecon-jacobi.ixx.

8  {
9  pInvDiag=std::make_shared<TArray1<T>>(pMatrix->shape(0));
10  update(*pMatrix);
11  }
std::shared_ptr< TArray1< T > > pInvDiag
virtual void update(void)
Definition: tarray.hxx:280
template<typename T >
numcxx::TPreconJacobi< T >::TPreconJacobi ( TSparseMatrix< T > &  A)
inline

Definition at line 14 of file tprecon-jacobi.ixx.

15  {
16  pInvDiag=std::make_shared<TArray1<T>>(A.shape(0));
17  update(A);
18  }
std::shared_ptr< TArray1< T > > pInvDiag
virtual void update(void)
Definition: tarray.hxx:280

+ Here is the call graph for this function:

template<typename T>
numcxx::TPreconJacobi< T >::~TPreconJacobi ( )
inline

Definition at line 26 of file tprecon-jacobi.hxx.

26 {};

+ Here is the call graph for this function:

Member Function Documentation

template<typename T >
std::shared_ptr< TPreconJacobi< T > > numcxx::TPreconJacobi< T >::create ( const std::shared_ptr< TSparseMatrix< T >>  pA)
inlinestatic

Create preconditioner.

Create LU factorization class.

Definition at line 23 of file tprecon-jacobi.ixx.

24  {
25  return std::make_shared<TPreconJacobi<T>>(pA);
26  }
template<typename T >
void numcxx::TPreconJacobi< T >::update ( TSparseMatrix< T > &  A)
inline

Perform actual computation preconditioner.

Perform actual computation of LU factorization.

Definition at line 30 of file tprecon-jacobi.ixx.

31  {
32  int n=M.shape(0);
33  assert(n==pInvDiag->size());
34  auto &InvDiag=*pInvDiag;
35  for (int i=0;i<n;i++)
36  InvDiag(i)=1.0/M(i,i);
37 
38  M.pattern_changed(false);
39  }
std::shared_ptr< TArray1< T > > pInvDiag

+ Here is the call graph for this function:

template<typename T >
void numcxx::TPreconJacobi< T >::solve ( TArray< T > &  Sol,
const TArray< T > &  Rhs 
) const
inlinevirtual

Solve preconditioning system.

Solve LU factorized system.

Reimplemented from numcxx::TLinSolver< T >.

Definition at line 43 of file tprecon-jacobi.ixx.

44  {
45  Sol.resize(Rhs.size());
46  int n=pInvDiag->size();
47  auto &InvDiag=*pInvDiag;
48  for (int i=0;i<n;i++)
49  Sol(i)=Rhs(i)*InvDiag(i);
50  }
std::shared_ptr< TArray1< T > > pInvDiag

+ Here is the call graph for this function:

template<typename T >
virtual void numcxx::TLinSolver< T >::update ( void  )
inlinevirtualinherited

Reimplemented in numcxx::TSolverUMFPACK< T >, and numcxx::TSolverLapackLU< T >.

Definition at line 280 of file tarray.hxx.

280 {};

Member Data Documentation

template<typename T>
std::shared_ptr< TArray1<T> > numcxx::TPreconJacobi< T >::pInvDiag

Definition at line 20 of file tprecon-jacobi.hxx.


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