Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType > Struct Template Reference

Least Squares Polynomial Preconditioner \( M^{-1} s( AM^{-1})\). More...

Public Types

using container_type = ContainerType
 
using value_type = get_value_type< ContainerType >
 value type of the ContainerType class More...
 

Public Member Functions

 LeastSquaresPreconditioner (Matrix op, InnerPreconditioner P, const ContainerType &copyable, value_type ev_max, unsigned degree)
 Construct k-th Least Squares Polynomial. More...
 
const ContainerType & copyable () const
 Return an object of same size as the object used for construction. More...
 
template<class ContainerType0 , class ContainerType1 >
void symv (const ContainerType0 &x, ContainerType1 &y)
 

Detailed Description

template<class Matrix, class InnerPreconditioner, class ContainerType>
struct dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >

Least Squares Polynomial Preconditioner \( M^{-1} s( AM^{-1})\).

Implements the least squares polynomial preconditioner as suggested by Youcef Saad, Practical Use of Polynomial Preconditionings for the Conjugate Gradient Method,SIAM J. Sci. and Stat. Comput., 6(4), 865–881 (1985)

Note
The least squares polynomial might (or might not) perform better than Chebyshev Polynomials and does not need an estimate of the lowest Eigenvalue
This class can be used as a Preconditioner in the CG algorithm. The CG algorithm forms an approximation to the solution in the form \( x_{k+1} = x_0 + P_k(A) r_0\) where \( P_k\) is a polynomial of degree k, which is optimal in minimizing the A-norm. Thus a polynomial preconditioner cannot decrease the number of matrix-vector multiplications needed to achieve a certain accuracy. However, since polynomial preconditioners do not use scalar products they may offset the increased overhead if the dot product becomes a bottleneck for performance or scalability.
See also
For more information see the book Iteratvie Methods for Sparse Linear Systems" 2nd edition by Yousef Saad
Template Parameters
MatrixPreferably a reference type
InnerPreconditionerPreferably a reference type
ContainerTypeAny class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
  • dg::HVec (serial), dg::DVec (cuda / omp), dg::MHVec (mpi + serial) or dg::MDVec (mpi + cuda / omp)
  • std::vector<dg::DVec> (vector of shared device vectors), std::array<double, 4> (array of 4 doubles) or std::map < std::string, dg::DVec> ( a map of named vectors)
  • double (scalar) and other primitive types ...
If there are several ContainerTypes in the argument list, then TensorTraits must exist for all of them
See also
See The dg dispatch system for a detailed explanation of our type dispatch system

Member Typedef Documentation

◆ container_type

template<class Matrix , class InnerPreconditioner , class ContainerType >
using dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >::container_type = ContainerType

◆ value_type

template<class Matrix , class InnerPreconditioner , class ContainerType >
using dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >::value_type = get_value_type<ContainerType>

value type of the ContainerType class

Constructor & Destructor Documentation

◆ LeastSquaresPreconditioner()

template<class Matrix , class InnerPreconditioner , class ContainerType >
dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >::LeastSquaresPreconditioner ( Matrix  op,
InnerPreconditioner  P,
const ContainerType &  copyable,
value_type  ev_max,
unsigned  degree 
)
inline

Construct k-th Least Squares Polynomial.

Parameters
opThe Matrix (copied, so maybe choose a reference type for shallow copying) will be called as dg::blas2::symv( op, x, y)
PThe inner Preconditioner (copied, so maybe choose a reference type for shallow copying) will be called as dg::blas2::symv( op, x, y)
copyableA ContainerType must be copy-constructible from this
ev_maxAn estimate of the largest Eigenvalue of \( M^{-1} A\). Use EVE to get this value
degreedegree k of the Polynomial (5 should be a good number - only up to degree 10 polynomials are implemented at the moment)

Member Function Documentation

◆ copyable()

template<class Matrix , class InnerPreconditioner , class ContainerType >
const ContainerType & dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >::copyable ( ) const
inline

Return an object of same size as the object used for construction.

Returns
A copyable object; what it contains is undefined, its size is important

◆ symv()

template<class Matrix , class InnerPreconditioner , class ContainerType >
template<class ContainerType0 , class ContainerType1 >
void dg::LeastSquaresPreconditioner< Matrix, InnerPreconditioner, ContainerType >::symv ( const ContainerType0 &  x,
ContainerType1 &  y 
)
inline

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