Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ug::ILinearOperatorInverse< X, Y > Class Template Referenceabstract

describes an inverse linear mapping X->Y More...

#include <linear_operator_inverse.h>

+ Inheritance diagram for ug::ILinearOperatorInverse< X, Y >:

Public Types

typedef Y codomain_function_type
 Range space.
 
typedef X domain_function_type
 Domain space.
 
- Public Types inherited from ug::ILinearIterator< X, Y >
typedef Y codomain_function_type
 Range space.
 
typedef X domain_function_type
 Domain space.
 

Public Member Functions

virtual bool apply (Y &u, const X &f)=0
 applies inverse operator, i.e. returns u = A^{-1} f
 
virtual bool apply_return_defect (Y &u, X &f)=0
 applies inverse operator, i.e. returns u = A^{-1} f and returns defect d := f - A*u
 
virtual bool apply_update_defect (Y &u, X &f)
 compute new correction c = B*d and update defect d := d - A*c
 
virtual SmartPtr< ILinearIterator< X, Y > > clone ()
 clone
 
virtual std::string config_string () const
 returns information about configuration parameters
 
SmartPtr< IConvergenceCheck< X > > convergence_check ()
 returns the convergence check
 
ConstSmartPtr< IConvergenceCheck< X > > convergence_check () const
 returns the convergence check
 
number defect () const
 returns the current defect
 
 ILinearOperatorInverse ()
 constructor setting convergence check to (100, 1e-12, 1e-12, true)
 
 ILinearOperatorInverse (SmartPtr< IConvergenceCheck< X > > spConvCheck)
 Default constructor.
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > J, const Y &u)
 initializes for the inverse for a linearized operator at linearization point u
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > L)
 initializes for the inverse for a linear operator
 
SmartPtr< ILinearOperator< Y, X > > linear_operator ()
 returns the current Operator this Inverse Operator is initialized for
 
virtual const char * name () const =0
 returns the name of the operator inverse
 
number reduction () const
 returns the current relative reduction
 
void set_convergence_check (SmartPtr< IConvergenceCheck< X > > spConvCheck)
 set the convergence check
 
virtual int standard_offset () const
 returns the standard offset for output
 
int step () const
 returns the current number of steps
 
virtual bool supports_parallel () const =0
 returns if parallel solving is supported
 
virtual ~ILinearOperatorInverse ()
 virtual destructor
 
- Public Member Functions inherited from ug::ILinearIterator< X, Y >
SmartPtr< IDamping< X, Y > > damping ()
 returns the scaling
 
 ILinearIterator ()
 constructor
 
 ILinearIterator (const ILinearIterator< X, Y > &parent)
 copy constructor
 
void set_damp (number factor)
 sets the damping to a constant factor
 
void set_damp (SmartPtr< IDamping< X, Y > > spScaling)
 sets a scaling for the correction
 
virtual ~ILinearIterator ()
 virtual destructor
 

Protected Attributes

SmartPtr< IConvergenceCheck< X > > m_spConvCheck
 smart pointer holding the convergence check
 
SmartPtr< ILinearOperator< Y, X > > m_spLinearOperator
 Operator that is inverted by this Inverse Operator.
 
- Protected Attributes inherited from ug::ILinearIterator< X, Y >
SmartPtr< IDamping< X, Y > > m_spDamping
 the scaling
 

Detailed Description

template<typename X, typename Y = X>
class ug::ILinearOperatorInverse< X, Y >

describes an inverse linear mapping X->Y

This class is the base class for the inversion of linear operator given in form of the ILinearOperator interface class. Given a operator L, the basic usage of this class is to invert this operator, i.e. to compute the solution u of

L*u = f     i.e. u := L^{-1} f

This application has been split up into three steps:

  1. init(): This method initializes the inverse operator. The inverse operator is initialized the way that, its application will be the inverse application of the operator L passed in by this function. The prepare method can only be called, when this method has been called once.
  2. apply(): This method performs the inversion. Before this method is called the init and prepare methods have to be called.

This splitting has been made, since initialization and preparation may be computationally expansive. Thus, the user of this class has the choice when to call this initialization/preparation. E.g. when the operator is applied several times on the same vectors, those have only to be prepared once and the init of the operator is only needed once.

Template Parameters
Xdomain space
Yrange space

Member Typedef Documentation

◆ codomain_function_type

template<typename X , typename Y = X>
typedef Y ug::ILinearOperatorInverse< X, Y >::codomain_function_type

Range space.

◆ domain_function_type

template<typename X , typename Y = X>
typedef X ug::ILinearOperatorInverse< X, Y >::domain_function_type

Domain space.

Constructor & Destructor Documentation

◆ ILinearOperatorInverse() [1/2]

template<typename X , typename Y = X>
ug::ILinearOperatorInverse< X, Y >::ILinearOperatorInverse ( )
inline

constructor setting convergence check to (100, 1e-12, 1e-12, true)

References new().

◆ ILinearOperatorInverse() [2/2]

template<typename X , typename Y = X>
ug::ILinearOperatorInverse< X, Y >::ILinearOperatorInverse ( SmartPtr< IConvergenceCheck< X > >  spConvCheck)
inline

Default constructor.

◆ ~ILinearOperatorInverse()

template<typename X , typename Y = X>
virtual ug::ILinearOperatorInverse< X, Y >::~ILinearOperatorInverse ( )
inlinevirtual

virtual destructor

Member Function Documentation

◆ apply()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply ( Y &  u,
const X &  f 
)
pure virtual

applies inverse operator, i.e. returns u = A^{-1} f

This method applies the inverse operator, i.e. u = A^{-1} f. The domain function f remains unchanged. Note, that this method can always be implemented by creating a copy of f and calling apply_return_defect with this copy.

Parameters
[in]fright-hand side
[out]usolution
Returns
bool success flag

Implements ug::ILinearIterator< X, Y >.

Implemented in ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::AnalyzingSolver< M, X, Y >, and ug::IMatrixOperatorInverse< M, X, Y >.

Referenced by ug::OperatorInverseIterator< TAlgebra >::apply(), ug::SchurInverseWithOperator< TAlgebra >::apply(), ug::SchurInverseWithFullMatrix< TAlgebra >::apply(), ug::SchurInverseWithAutoFullMatrix< TAlgebra >::apply(), ug::PowerMethod< TAlgebra >::calculate_max_eigenvalue(), and ug::PowerMethod< TAlgebra >::calculate_min_eigenvalue().

◆ apply_return_defect()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply_return_defect ( Y &  u,
X &  f 
)
pure virtual

applies inverse operator, i.e. returns u = A^{-1} f and returns defect d := f - A*u

This method applies the inverse operator, i.e. u = A^{-1} f. The domain function f is changed in the way, that the defect d := f - A*u is returned in the function. This is always useful, when the inverting algorithm can (or must) update the defect during computation (this is e.g. the case for the geometric multigrid method). Note, that this method can always be implemented by calling apply and then computing d := f - A*u.

Parameters
[in,out]fright-hand side
[out]usolution
Returns
bool success flag

Implemented in ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::AnalyzingSolver< M, X, Y >, and ug::IMatrixOperatorInverse< M, X, Y >.

Referenced by ug::IPreconditionedLinearOperatorInverse< X >::apply(), ug::SchurInverseWithOperator< TAlgebra >::apply_return_defect(), ug::SchurInverseWithFullMatrix< TAlgebra >::apply_return_defect(), ug::SchurInverseWithAutoFullMatrix< TAlgebra >::apply_return_defect(), ug::OperatorInverseIterator< TAlgebra >::apply_update_defect(), and ug::ILinearOperatorInverse< X, Y >::apply_update_defect().

◆ apply_update_defect()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply_update_defect ( Y &  c,
X &  d 
)
inlinevirtual

compute new correction c = B*d and update defect d := d - A*c

This method applies the inverse operator, i.e. c = B*d. The domain function d is changed in the way, that the defect d := d - A*c is returned in the function. This is always useful, when the iterating algorithm can (or must) update the defect during computation (this is e.g. the case for the geometric multigrid method). Note, that this method can always be implemented by calling apply and then computing d := d - A*c.

Parameters
[in,out]ddefect
[out]ucorrection
Returns
bool success flag

Implements ug::ILinearIterator< X, Y >.

References ug::ILinearOperatorInverse< X, Y >::apply_return_defect().

Referenced by ug::LinearSolver< TVector >::compute_correction().

◆ clone()

template<typename X , typename Y = X>
virtual SmartPtr< ILinearIterator< X, Y > > ug::ILinearOperatorInverse< X, Y >::clone ( )
inlinevirtual

clone

Implements ug::ILinearIterator< X, Y >.

Reimplemented in ug::IExternalSolver< TAlgebra >.

References SPNULL, and UG_THROW.

◆ config_string()

template<typename X , typename Y = X>
virtual std::string ug::ILinearOperatorInverse< X, Y >::config_string ( ) const
inlinevirtual

◆ convergence_check() [1/2]

template<typename X , typename Y = X>
SmartPtr< IConvergenceCheck< X > > ug::ILinearOperatorInverse< X, Y >::convergence_check ( )
inline

returns the convergence check

References ug::ILinearOperatorInverse< X, Y >::m_spConvCheck.

◆ convergence_check() [2/2]

◆ defect()

template<typename X , typename Y = X>
number ug::ILinearOperatorInverse< X, Y >::defect ( ) const
inline

◆ init() [1/2]

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::init ( SmartPtr< ILinearOperator< Y, X > >  J,
const Y &  u 
)
inlinevirtual

initializes for the inverse for a linearized operator at linearization point u

This method passes the linear operator J(u) that should be inverted by this operator. As second argument the linearization point is passed. This is needed e.g. for the geometric multigrid method, that inverts a linearized operator based on coarser grid operators, that have to be initialized based on the linearization point.

Parameters
[in]Jlinearized operator to invert
[in]ulinearization point
Returns
bool success flag

Implements ug::ILinearIterator< X, Y >.

Reimplemented in ug::IMatrixOperatorInverse< M, X, Y >, ug::AnalyzingSolver< M, X, Y >, and ug::LU< TAlgebra >.

References ug::ILinearOperatorInverse< X, Y >::m_spLinearOperator.

◆ init() [2/2]

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::init ( SmartPtr< ILinearOperator< Y, X > >  L)
inlinevirtual

◆ linear_operator()

◆ name()

◆ reduction()

template<typename X , typename Y = X>
number ug::ILinearOperatorInverse< X, Y >::reduction ( ) const
inline

◆ set_convergence_check()

template<typename X , typename Y = X>
void ug::ILinearOperatorInverse< X, Y >::set_convergence_check ( SmartPtr< IConvergenceCheck< X > >  spConvCheck)
inline

◆ standard_offset()

template<typename X , typename Y = X>
virtual int ug::ILinearOperatorInverse< X, Y >::standard_offset ( ) const
inlinevirtual

returns the standard offset for output

Referenced by ug::ILinearOperatorInverse< X, Y >::set_convergence_check().

◆ step()

template<typename X , typename Y = X>
int ug::ILinearOperatorInverse< X, Y >::step ( ) const
inline

◆ supports_parallel()

Member Data Documentation

◆ m_spConvCheck

◆ m_spLinearOperator

template<typename X , typename Y = X>
SmartPtr<ILinearOperator<Y,X> > ug::ILinearOperatorInverse< X, Y >::m_spLinearOperator
protected

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