EXPERIMENTAL Tridiagonalize \(A\) and approximate \(f(A)b \approx R f(\tilde T) e_1\) via CG algorithm. A is self-adjoint in the weights \( W\).
More...
|
| MCG () |
| Allocate nothing, Call construct method before usage. More...
|
|
| MCG (const ContainerType ©able, unsigned max_iterations) |
| Allocate memory for the mcg method. More...
|
|
void | set_max (unsigned new_max) |
| Set the maximum number of iterations. More...
|
|
unsigned | get_max () const |
| Get the current maximum number of iterations. More...
|
|
void | set_verbose (bool verbose) |
| Set or unset debugging output during iterations. More...
|
|
value_type | get_bnorm () const |
| Norm of b from last call to operator() More...
|
|
template<class ... Params> |
void | construct (Params &&...ps) |
| Perfect forward parameters to one of the constructors. More...
|
|
unsigned | get_iter () const |
| Get the number of iterations in the last call to operator() (size of T) More...
|
|
template<class MatrixType , class DiaMatrixType , class ContainerType0 , class ContainerType1 , class ContainerType2 > |
void | Ry (MatrixType &&A, const DiaMatrixType &T, const ContainerType0 &y, ContainerType1 &x, const ContainerType2 &b) |
| Compute x = R y. More...
|
|
template<class MatrixType , class ContainerType0 , class ContainerType1 > |
const HDiaMatrix & | operator() (MatrixType &&A, const ContainerType0 &b, const ContainerType1 &weights, value_type eps=1e-12, value_type nrmb_correction=1., value_type res_fac=1.) |
| Tridiagonalize the system \( A\vec b\) using CG. More...
|
|
HVec | make_e1 () |
| Return the vector \( \vec e_1\) with size get_iter() More...
|
|
template<class ContainerType>
class dg::mat::MCG< ContainerType >
EXPERIMENTAL Tridiagonalize \(A\) and approximate \(f(A)b \approx R f(\tilde T) e_1\) via CG algorithm. A is self-adjoint in the weights \( W\).
- Attention
- This class has the exact same result as the corresponding UniversalLanczos class. Its use is for mere experimental purposes.
This class is based on the approach of the paper An iterative solution method for solving f(A)x = b, using Krylov subspace information obtained for the symmetric positive definite matrix A by H. A. Van Der Vorst
- Note
- The approximation relies on Projection \(x = f(A) b \approx R f(\tilde T) e_1\), where \(\tilde T\) and \(R\) are the tridiagonal and orthogonal matrix of the CG solve respectively and \(e_1\) is the normalized unit vector.
◆ HCooMatrix
template<class ContainerType >
◆ HDiaMatrix
template<class ContainerType >
◆ HVec
template<class ContainerType >
◆ value_type
template<class ContainerType >
value type of the ContainerType class
◆ MCG() [1/2]
template<class ContainerType >
Allocate nothing, Call construct
method before usage.
◆ MCG() [2/2]
template<class ContainerType >
dg::mat::MCG< ContainerType >::MCG |
( |
const ContainerType & |
copyable, |
|
|
unsigned |
max_iterations |
|
) |
| |
|
inline |
Allocate memory for the mcg method.
- Parameters
-
copyable | A ContainerType must be copy-constructible from this |
max_iterations | Maximum number of iterations to be used |
◆ construct()
template<class ContainerType >
template<class ... Params>
void dg::mat::MCG< ContainerType >::construct |
( |
Params &&... |
ps | ) |
|
|
inline |
Perfect forward parameters to one of the constructors.
- Template Parameters
-
Params | deduced by the compiler |
- Parameters
-
ps | parameters forwarded to constructors |
◆ get_bnorm()
template<class ContainerType >
Norm of b
from last call to operator()
- Returns
- bnorm
◆ get_iter()
template<class ContainerType >
Get the number of iterations in the last call to operator()
(size of T)
- Returns
- the number of iterations in the last call to
operator()
◆ get_max()
template<class ContainerType >
Get the current maximum number of iterations.
- Returns
- the current maximum
◆ make_e1()
template<class ContainerType >
Return the vector \( \vec e_1\) with size get_iter()
- Parameters
-
- Returns
- e_1
◆ operator()()
template<class ContainerType >
template<class MatrixType , class ContainerType0 , class ContainerType1 >
Tridiagonalize the system \( A\vec b\) using CG.
- Parameters
-
A | A self-adjoint, positive definit matrix |
b | The right hand side vector. |
weights | Weights that define the scalar product in which A is self-adjoint and in which the error norm is computed. |
eps | relative accuracy of residual |
nrmb_correction | the absolute error C in units of eps to be respected |
res_fac | factor that is multiplied to the norm of the residual. Used to account for specific matrix function and operator in the convergence criterium |
- Returns
- The tridiagonal matrix \( T\) with size
get_iter()
- Note
- So far only ordinary convergence criterium of CG method, in particular for \( A x = b \). If used for matrix function computation, \( f(A) x = b \), the parameter eps should be multiplied with appropriate factors to account for the different convergence criteria. The Matrix R and T of the tridiagonalization are further used for computing matrix functions. The x vector must be initialized with 0 if used for tridiagonalization.
◆ Ry()
template<class ContainerType >
template<class MatrixType , class DiaMatrixType , class ContainerType0 , class ContainerType1 , class ContainerType2 >
void dg::mat::MCG< ContainerType >::Ry |
( |
MatrixType && |
A, |
|
|
const DiaMatrixType & |
T, |
|
|
const ContainerType0 & |
y, |
|
|
ContainerType1 & |
x, |
|
|
const ContainerType2 & |
b |
|
) |
| |
|
inline |
Compute x = R y.
- Parameters
-
A | A self-adjoint, positive definit matrix |
T | T non-symmetric tridiagonal Matrix from MCG tridiagonalization |
y | (host) vector with v.size() = iter. Must have size of T.num_rows . Typically \( T^{(-1)} e_1 \) or \( f(T^{(-1)}) e_1 \) |
x | Contains the matrix approximation \(x = Ry \) (output) |
b | The right hand side vector. |
◆ set_max()
template<class ContainerType >
void dg::mat::MCG< ContainerType >::set_max |
( |
unsigned |
new_max | ) |
|
|
inline |
Set the maximum number of iterations.
- Parameters
-
new_max | New maximum number |
◆ set_verbose()
template<class ContainerType >
void dg::mat::MCG< ContainerType >::set_verbose |
( |
bool |
verbose | ) |
|
|
inline |
Set or unset debugging output during iterations.
- Parameters
-
verbose | If true, additional output will be written to std::cout during solution |
The documentation for this class was generated from the following file: