Computation of \( \vec x = f(A,\vec d)\vec b\) or \( \vec x = f( \vec d, A) \vec b\) where \( A \) is a positive (semi)-definite matrix self-adjoint in the weights \( W\) .
More...
|
| | CauchyMatrixProduct ()=default |
| |
| | CauchyMatrixProduct (double lm_eps, const Geometry &grid, unsigned stages, bool adjoint=true) |
| |
| const dg::MultigridCG2d< Geometry, Matrix, ComplexContainer, dg::complex_symmetric > & | multigrid () const |
| | Access the internal multigrid method to be able to construct matrices.
|
| |
| void | clear_cache () |
| | Clear the cached Eigenvalues of the matrix in the solve method.
|
| |
| void | set_verbose (bool verbose) |
| | Verbose output to std::cout.
|
| |
| unsigned | num_nodes () const |
| | Number of (complex) nodes used in the latest call to solve.
|
| |
| void | set_adjoint (bool adjoint) |
| | Determine if adjoint or direct bivariate matrix function is computed.
|
| |
| bool | get_adjoint () const |
| | Current value of the adjoint parameter.
|
| |
| template<class MatrixType , class UnaryFunc , class UnaryFuncD , class ContainerType0 , class ContainerType1 , class ContainerType2 > |
| void | solve (ContainerType0 &x, UnaryFunc func, UnaryFuncD dxfunc, std::vector< MatrixType > &ops, const ContainerType1 &d, const ContainerType2 &b, std::vector< double > eps) |
| | Compute the bivariate matrix function.
|
| |
template<class Geometry, class
Matrix, class ComplexContainer>
struct dg::mat::CauchyMatrixProduct< Geometry, Matrix, ComplexContainer >
Computation of \( \vec x = f(A,\vec d)\vec b\) or \( \vec x = f( \vec d, A) \vec b\) where \( A \) is a positive (semi)-definite matrix self-adjoint in the weights \( W\) .
This class implements the Cauchy contour integral method
\[
\begin{align}
f( A, D) \vec b \approx \sum_{k=1}^{N} \frac{1}{z_k 1 - A} w_kf(z_k, D) \vec b\\
f( D, A) \vec b \approx \sum_{k=1}^{N} w_kf(z_k, D)\frac{1}{z_k 1 - A} \vec b\\
\end{align
\]
The complex nodes and weights \( z_k\) and \( w_k\) are found by applying the Levenberg-Marquardt optimization to an initial Talbot curve. The number of nodes is such that the given error tolerance is fulfilled. The individual complex Helmholtz type equations are solved using a dg::MultigridCG2d COCG algorithm and we store the previous result at every timestep
The class automatically caches the extreme Eigenvalues of the matrix A. Furthermore, the previous solution(s) to the Helmholtz equations are stored. The solve method automatically recognises a change in D or the matrix function f and accordingly recomputes nodes and weighs and clears the previous solution cache. However, changes in A are not automatically recognised. If the matrix needs to change the clear_cache member function must be called before the next solve call in order to trigger a re-computation of the Eigenvalues.
- Template Parameters
-
| Geometry | The Geometry type in dg::MultigridCG2d |
| Matrix | The (real) derviative class for projection / interpolation in Multigrid |
| ComplexContainer | A complex Container type |
template<class Geometry , class
Matrix , class ComplexContainer >
template<class MatrixType , class UnaryFunc , class UnaryFuncD , class ContainerType0 , class ContainerType1 , class ContainerType2 >
| void dg::mat::CauchyMatrixProduct< Geometry, Matrix, ComplexContainer >::solve |
( |
ContainerType0 & | x, |
|
|
UnaryFunc | func, |
|
|
UnaryFuncD | dxfunc, |
|
|
std::vector< MatrixType > & | ops, |
|
|
const ContainerType1 & | d, |
|
|
const ContainerType2 & | b, |
|
|
std::vector< double > | eps ) |
|
inline |
Compute the bivariate matrix function.
In the first call the extreme Eigenvalues of ops[0] are computed and stored. In the following calls the cached Eigenvalues are used unless clear_cache is called beforehand.
In a first step we then determine if the previously used nodes and weights are still sufficient for the given parameters and optionally re-compute them. (The method tries to avoid recomputing the nodes if possible because of how long it may take). In a second step the num_nodes complex Helmholtz problems are solved using multigrid methods and initial guesses from previous solves.
- Parameters
-
| x | (write-only) Contains solution on output |
| func | The bivariate matrix function |
| dxfunc | The derivative of the bivariate matrix function |
| ops | The matrix discretized on the grid used in multigrid() |
| d | The diagonal vector |
| b | the right hand side |
| eps | the error tolerance forwarded to the multigrid().solve method |