rheolef  6.3
Public Types | Public Member Functions | List of all members
rheolef::solver_basic< T, M > Class Template Reference

solver - direct or interative solver interface More...

#include <solver.h>

Inheritance diagram for rheolef::solver_basic< T, M >:
Inheritance graph
[legend]
Collaboration diagram for rheolef::solver_basic< T, M >:
Collaboration graph
[legend]

Public Types

typedef solver_rep< T, M > rep
typedef smart_pointer< repbase

Public Member Functions

 solver_basic ()
 solver_basic (const csr< T, M > &a, const solver_option_type &opt=solver_option_type())
void update_values (const csr< T, M > &a)
vec< T, M > trans_solve (const vec< T, M > &b) const
vec< T, M > solve (const vec< T, M > &b) const
- Public Member Functions inherited from rheolef::smart_pointer< solver_rep< T, M > >
 smart_pointer (solver_rep< T, M > *p=0)
 smart_pointer (const smart_pointer< solver_rep< T, M > > &x)
smart_pointer< solver_rep< T,
M > > & 
operator= (const smart_pointer< solver_rep< T, M > > &x)
 ~smart_pointer ()
- Public Member Functions inherited from rheolef::smart_pointer_base< solver_rep< T, M >, details::constructor_copy< solver_rep< T, M > > >
 smart_pointer_base (solver_rep< T, M > *p=0)
 smart_pointer_base (const smart_pointer_base< solver_rep< T, M >, details::constructor_copy< solver_rep< T, M > > > &)
smart_pointer_base< solver_rep
< T, M >
, details::constructor_copy
< solver_rep< T, M > > > & 
operator= (const smart_pointer_base< solver_rep< T, M >, details::constructor_copy< solver_rep< T, M > > > &)
 ~smart_pointer_base ()
const solver_rep< T, M > * pointer () const
solver_rep< T, M > * pointer ()
const solver_rep< T, M > & data () const
solver_rep< T, M > & data ()
const solver_rep< T, M > * operator-> () const
solver_rep< T, M > * operator-> ()
const solver_rep< T, M > & operator* () const
solver_rep< T, M > & operator* ()
int reference_counter () const

Detailed Description

template<class T, class M = rheo_default_memory_model>
class rheolef::solver_basic< T, M >

solver - direct or interative solver interface

The class implements a matrix factorization: LU factorization for an unsymmetric matrix and Choleski fatorisation for a symmetric one.

Let a be a square invertible matrix in csr format (see csr).

csr<Float> a;

We get the factorization by:

solver<Float> sa (a);

Each call to the direct solver for a*x = b writes either:

vec<Float> x = sa.solve(b);

When the matrix is modified in a computation loop but conserves its sparsity pattern, an efficient re-factorization writes:

sa.update_values (new_a);
x = sa.solve(b);

This approach skip the long step of the symbolic factization step.

ITERATIVE SOLVER

The factorization can also be incomplete, i.e. a pseudo-inverse, suitable for preconditionning iterative methods. In that case, the sa.solve(b) call runs a conjugate gradient when the matrix is symmetric, or a generalized minimum residual algorithm when the matrix is unsymmetric.

AUTOMATIC CHOICE AND CUSTOMIZATION

The symmetry of the matrix is tested via the a.is_symmetric() property (see csr) while the choice between direct or iterative solver is switched from the a.pattern_dimension() value. When the pattern is 3D, an iterative method is faster and less memory consuming. Otherwhise, for 1D or 2D problems, the direct method is prefered.

These default choices can be supersetted by using explicit options:

solver_option_type opt;
opt.iterative = true;
solver<Float> sa (a, opt);

See the solver.h header for the complete list of available options.

IMPLEMENTATION NOTE

The implementation bases on the pastix library.

See Also
csr.

Definition at line 128 of file solver.h.

Member Typedef Documentation

template<class T, class M = rheo_default_memory_model>
typedef solver_rep<T,M> rheolef::solver_basic< T, M >::rep

Definition at line 131 of file solver.h.

template<class T, class M = rheo_default_memory_model>
typedef smart_pointer<rep> rheolef::solver_basic< T, M >::base

Definition at line 132 of file solver.h.

Constructor & Destructor Documentation

template<class T , class M >
endcode rheolef::solver_basic< T, M >::solver_basic ( )
inline

Definition at line 157 of file solver.h.

template<class T , class M >
rheolef::solver_basic< T, M >::solver_basic ( const csr< T, M > &  a,
const solver_option_type opt = solver_option_type() 
)
inlineexplicit

Definition at line 163 of file solver.h.

Member Function Documentation

template<class T , class M >
void rheolef::solver_basic< T, M >::update_values ( const csr< T, M > &  a)
inline

Definition at line 202 of file solver.h.

template<class T , class M >
vec< T, M > rheolef::solver_basic< T, M >::trans_solve ( const vec< T, M > &  b) const
inline

Definition at line 216 of file solver.h.

template<class T , class M >
vec< T, M > rheolef::solver_basic< T, M >::solve ( const vec< T, M > &  b) const
inline

Definition at line 209 of file solver.h.


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