ug4
ug::LU< TAlgebra > Class Template Reference

#include <lu.h>

+ Inheritance diagram for ug::LU< TAlgebra >:

Public Types

typedef TAlgebra algebra_type
 Algebra type. More...
 
typedef IMatrixOperatorInverse< matrix_type, vector_typebase_type
 Base type. More...
 
typedef TAlgebra::matrix_type matrix_type
 Matrix type. More...
 
typedef TAlgebra::vector_type vector_type
 Vector type. More...
 
- Public Types inherited from ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >
typedef TAlgebra::vector_type codomain_function_type
 Range space. More...
 
typedef TAlgebra::vector_type domain_function_type
 Domain space. More...
 
typedef TAlgebra::matrix_type matrix_type
 Matrix type. More...
 
- Public Types inherited from ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >
typedef TAlgebra::vector_type codomain_function_type
 Range space. More...
 
typedef TAlgebra::vector_type domain_function_type
 Domain space. More...
 
- Public Types inherited from ug::ILinearIterator< X, Y >
typedef Y codomain_function_type
 Range space. More...
 
typedef X domain_function_type
 Domain space. More...
 

Public Member Functions

virtual bool apply (vector_type &u, const vector_type &f)
 Compute u = L^{-1} * f. More...
 
bool apply_lu (vector_type &x, const vector_type &b)
 
virtual bool apply_return_defect (vector_type &u, vector_type &f)
 Compute u = L^{-1} * f AND return defect f := f - L*u. More...
 
virtual std::string config_string () const
 returns information about configuration parameters More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > A)
 initializes this inverse operator for a linear operator More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > A, const Y &u)
 initializes this inverse operator for a linear operator More...
 
virtual bool init (SmartPtr< MatrixOperator< M, Y, X > > A)=0
 initializes this inverse operator for a matrix-based operator More...
 
virtual bool init (SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
 set operator L, that will be inverted More...
 
bool init_lu (const matrix_type *pA)
 initializes the solver for a matrix A More...
 
 LU ()
 constructor More...
 
virtual const char * name () const
 returns the name of the operator inverse More...
 
void set_info (bool b)
 
void set_minimum_for_sparse (size_t N)
 
void set_show_progress (bool b)
 
void set_sort_sparse (bool b)
 
virtual bool supports_parallel () const
 returns if parallel solving is supported More...
 
virtual ~LU ()
 Destructor. More...
 
- Public Member Functions inherited from ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >
virtual bool init (SmartPtr< ILinearOperator< TAlgebra::vector_type, TAlgebra::vector_type > > A)
 initializes this inverse operator for a linear operator More...
 
virtual bool init (SmartPtr< ILinearOperator< TAlgebra::vector_type, TAlgebra::vector_type > > A, const TAlgebra::vector_type &u)
 initializes this inverse operator for a linear operator More...
 
virtual bool init (SmartPtr< MatrixOperator< TAlgebra::matrix_type, TAlgebra::vector_type, TAlgebra::vector_type > > A)=0
 initializes this inverse operator for a matrix-based operator More...
 
virtual ~IMatrixOperatorInverse ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >
virtual bool apply_update_defect (TAlgebra::vector_type &u, TAlgebra::vector_type &f)
 
virtual SmartPtr< ILinearIterator< TAlgebra::vector_type, TAlgebra::vector_type > > clone ()
 clone More...
 
SmartPtr< IConvergenceCheck< TAlgebra::vector_type > > convergence_check ()
 returns the convergence check More...
 
ConstSmartPtr< IConvergenceCheck< TAlgebra::vector_type > > convergence_check () const
 returns the convergence check More...
 
number defect () const
 returns the current defect More...
 
 ILinearOperatorInverse ()
 constructor setting convergence check to (100, 1e-12, 1e-12, true) More...
 
 ILinearOperatorInverse (SmartPtr< IConvergenceCheck< TAlgebra::vector_type > > spConvCheck)
 Default constructor. More...
 
SmartPtr< ILinearOperator< TAlgebra::vector_type, TAlgebra::vector_type > > linear_operator ()
 returns the current Operator this Inverse Operator is initialized for More...
 
number reduction () const
 returns the current relative reduction More...
 
void set_convergence_check (SmartPtr< IConvergenceCheck< TAlgebra::vector_type > > spConvCheck)
 set the convergence check More...
 
virtual int standard_offset () const
 returns the standard offset for output More...
 
int step () const
 returns the current number of steps More...
 
virtual ~ILinearOperatorInverse ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::ILinearIterator< X, Y >
virtual bool apply (Y &c, const X &d)=0
 compute new correction c = B*d More...
 
virtual bool apply_update_defect (Y &c, X &d)=0
 compute new correction c = B*d and update defect d := d - A*c More...
 
SmartPtr< IDamping< X, Y > > damping ()
 returns the scaling More...
 
 ILinearIterator ()
 constructor More...
 
 ILinearIterator (const ILinearIterator< X, Y > &parent)
 copy constructor More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > J, const Y &u)=0
 initialize for operator J(u) and linearization point u More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > L)=0
 initialize for linear operator L More...
 
void set_damp (number factor)
 sets the damping to a constant factor More...
 
void set_damp (SmartPtr< IDamping< X, Y > > spScaling)
 sets a scaling for the correction More...
 
virtual ~ILinearIterator ()
 virtual destructor More...
 

Protected Attributes

SmartPtr< ILUTScalarPreconditioner< algebra_type > > ilut_scalar
 
CPUAlgebra::vector_type m_b
 
bool m_bDense
 
bool m_bInfo
 
bool m_bShowProgress
 
bool m_bSortSparse
 
size_t m_iMinimumForSparse
 
DenseMatrixInverse< DenseMatrix< VariableArray2< double > > > m_mat
 inverse More...
 
const matrix_typem_pMatrix
 matrix to invert More...
 
size_t m_size
 
SmartPtr< MatrixOperator< matrix_type, vector_type > > m_spOperator
 Operator to invert. More...
 
DenseVector< VariableArray1< double > > m_tmp
 
CPUAlgebra::vector_type m_u
 
- Protected Attributes inherited from ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >
SmartPtr< IConvergenceCheck< TAlgebra::vector_type > > m_spConvCheck
 smart pointer holding the convergence check More...
 
SmartPtr< ILinearOperator< TAlgebra::vector_type, TAlgebra::vector_type > > m_spLinearOperator
 Operator that is inverted by this Inverse Operator. More...
 
- Protected Attributes inherited from ug::ILinearIterator< X, Y >
SmartPtr< IDamping< X, Y > > m_spDamping
 the scaling More...
 

Private Member Functions

bool init_dense (const matrix_type &A)
 returns name of solver More...
 
bool init_sparse (const matrix_type &A)
 
void init_var (const matrix_type &A)
 
void print_info (const matrix_type &A)
 
bool solve_dense (vector_type &x, const vector_type &b)
 
bool solve_sparse (vector_type &x, const vector_type &b)
 

Member Typedef Documentation

◆ algebra_type

template<typename TAlgebra >
typedef TAlgebra ug::LU< TAlgebra >::algebra_type

Algebra type.

◆ base_type

template<typename TAlgebra >
typedef IMatrixOperatorInverse<matrix_type,vector_type> ug::LU< TAlgebra >::base_type

Base type.

◆ matrix_type

template<typename TAlgebra >
typedef TAlgebra::matrix_type ug::LU< TAlgebra >::matrix_type

Matrix type.

◆ vector_type

template<typename TAlgebra >
typedef TAlgebra::vector_type ug::LU< TAlgebra >::vector_type

Vector type.

Constructor & Destructor Documentation

◆ LU()

template<typename TAlgebra >
ug::LU< TAlgebra >::LU ( )
inline

constructor

References ug::LU< TAlgebra >::m_iMinimumForSparse.

◆ ~LU()

template<typename TAlgebra >
virtual ug::LU< TAlgebra >::~LU ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ apply()

◆ apply_lu()

◆ apply_return_defect()

template<typename TAlgebra >
virtual bool ug::LU< TAlgebra >::apply_return_defect ( vector_type u,
vector_type f 
)
inlinevirtual

◆ config_string()

template<typename TAlgebra >
virtual std::string ug::LU< TAlgebra >::config_string ( ) const
inlinevirtual

returns information about configuration parameters

this should return necessary information about parameters and possibly calling config_string of subcomponents.

Returns
std::string necessary information about configuration parameters

Reimplemented from ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >.

References ug::LU< TAlgebra >::m_iMinimumForSparse.

◆ init() [1/4]

template<typename TAlgebra >
virtual bool ug::IMatrixOperatorInverse< M, X, Y >::init
inline

initializes this inverse operator for a linear operator

This method implements the ILinearOperatorInverse interface method. Basically, the request is forwarded to the matrix-based init method, if the the operator is matrix-based. If the operator is not matrix-based this inverse can not be used and false is returned

Parameters
[in]Alinear matrix-based operator to invert
Returns
bool success flag

◆ init() [2/4]

template<typename TAlgebra >
virtual bool ug::IMatrixOperatorInverse< M, X, Y >::init
inline

initializes this inverse operator for a linear operator

This method implements the ILinearOperatorInverse interface method. Basically, the request is forwarded to the matrix-based init method, if the the operator is matrix-based. If the operator is not matrix-based this inverse can not be used and false is returned

Parameters
[in]Alinear matrix-based operator to invert
[in]ulinearization point
Returns
bool success flag

◆ init() [3/4]

template<typename TAlgebra >
virtual bool ug::IMatrixOperatorInverse< M, X, Y >::init

initializes this inverse operator for a matrix-based operator

This method passes the operator A that is inverted by this operator. In addition some preparation step can be made.

Parameters
[in]Alinear matrix-basewd operator to invert
Returns
bool success flag

◆ init() [4/4]

template<typename TAlgebra >
virtual bool ug::LU< TAlgebra >::init ( SmartPtr< MatrixOperator< matrix_type, vector_type > >  Op)
inlinevirtual

set operator L, that will be inverted

References ug::LU< TAlgebra >::init_lu(), ug::LU< TAlgebra >::m_spOperator, and UG_LOG.

◆ init_dense()

◆ init_lu()

◆ init_sparse()

◆ init_var()

template<typename TAlgebra >
void ug::LU< TAlgebra >::init_var ( const matrix_type A)
inlineprivate

References UG_ASSERT.

Referenced by ug::LU< TAlgebra >::init_lu().

◆ name()

template<typename TAlgebra >
virtual const char* ug::LU< TAlgebra >::name ( ) const
inlinevirtual

returns the name of the operator inverse

This method returns the name of the inverse operator. This function is typically needed, when the inverse operator is used inside of another and some debug output should be printed

Returns
const char* name of inverse operator

Implements ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >.

◆ print_info()

template<typename TAlgebra >
void ug::LU< TAlgebra >::print_info ( const matrix_type A)
inlineprivate

◆ set_info()

template<typename TAlgebra >
void ug::LU< TAlgebra >::set_info ( bool  b)
inline

◆ set_minimum_for_sparse()

template<typename TAlgebra >
void ug::LU< TAlgebra >::set_minimum_for_sparse ( size_t  N)
inline

◆ set_show_progress()

template<typename TAlgebra >
void ug::LU< TAlgebra >::set_show_progress ( bool  b)
inline

◆ set_sort_sparse()

template<typename TAlgebra >
void ug::LU< TAlgebra >::set_sort_sparse ( bool  b)
inline

◆ solve_dense()

template<typename TAlgebra >
bool ug::LU< TAlgebra >::solve_dense ( vector_type x,
const vector_type b 
)
inlineprivate

◆ solve_sparse()

template<typename TAlgebra >
bool ug::LU< TAlgebra >::solve_sparse ( vector_type x,
const vector_type b 
)
inlineprivate

◆ supports_parallel()

template<typename TAlgebra >
virtual bool ug::LU< TAlgebra >::supports_parallel ( ) const
inlinevirtual

returns if parallel solving is supported

Implements ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >.

Member Data Documentation

◆ ilut_scalar

template<typename TAlgebra >
SmartPtr<ILUTScalarPreconditioner<algebra_type> > ug::LU< TAlgebra >::ilut_scalar
protected

◆ m_b

template<typename TAlgebra >
CPUAlgebra::vector_type ug::LU< TAlgebra >::m_b
protected

◆ m_bDense

template<typename TAlgebra >
bool ug::LU< TAlgebra >::m_bDense
protected

◆ m_bInfo

template<typename TAlgebra >
bool ug::LU< TAlgebra >::m_bInfo
protected

◆ m_bShowProgress

template<typename TAlgebra >
bool ug::LU< TAlgebra >::m_bShowProgress
protected

◆ m_bSortSparse

template<typename TAlgebra >
bool ug::LU< TAlgebra >::m_bSortSparse
protected

◆ m_iMinimumForSparse

template<typename TAlgebra >
size_t ug::LU< TAlgebra >::m_iMinimumForSparse
protected

◆ m_mat

template<typename TAlgebra >
DenseMatrixInverse<DenseMatrix<VariableArray2<double> > > ug::LU< TAlgebra >::m_mat
protected

◆ m_pMatrix

template<typename TAlgebra >
const matrix_type* ug::LU< TAlgebra >::m_pMatrix
protected

◆ m_size

template<typename TAlgebra >
size_t ug::LU< TAlgebra >::m_size
protected

◆ m_spOperator

template<typename TAlgebra >
SmartPtr<MatrixOperator<matrix_type, vector_type> > ug::LU< TAlgebra >::m_spOperator
protected

Operator to invert.

Referenced by ug::LU< TAlgebra >::init().

◆ m_tmp

template<typename TAlgebra >
DenseVector<VariableArray1<double> > ug::LU< TAlgebra >::m_tmp
protected

◆ m_u

template<typename TAlgebra >
CPUAlgebra::vector_type ug::LU< TAlgebra >::m_u
protected

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