Extension: Matrix functions
#include "dg/matrix/matrix.h"

\( x \approx f(A)b \) More...

Collaboration diagram for Matrix-functions:

Classes

class  dg::mat::UniversalLanczos< ContainerType >
 Tridiagonalize \(A\) and approximate \(f(A)b \approx |b|_W V f(T) e_1\) via Lanczos algorithm. A is self-adjoint in the weights \( W\). More...
 
struct  dg::mat::MatrixSqrt< ContainerType >
 Fast computation of \( \vec x = A^{\pm 1/2}\vec b\) for self-adjoint positive definite \(A\). More...
 
struct  dg::mat::MatrixFunction< ContainerType >
 Computation of \( \vec x = f(A)\vec b\) for self-adjoint positive definite \( A\). More...
 
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\). More...
 
class  dg::mat::MCGFuncEigen< Container >
 EXPERIMENTAL Shortcut for \(x \approx f(A) b \) solve via exploiting first a Krylov projection achieved by the M-CG method and a matrix function computation via Eigen-decomposition. More...
 
struct  dg::mat::SqrtCauchyInt< Container >
 Cauchy integral \( \sqrt{A} b= A\frac{ 2 K' \sqrt{m}}{\pi N} \sum_{j=1}^{N} ( w_j^2 I + A)^{-1} c_j d_j b \) More...
 
struct  dg::mat::DirectSqrtCauchy< Container >
 Shortcut for \(b \approx \sqrt{A} x \) solve directly via sqrt Cauchy combined with PCG inversions. More...
 
struct  dg::mat::InvSqrtODE< Container >
 Right hand side of the square root ODE. More...
 

Functions

template<class value_type , class ExplicitRHS >
auto dg::mat::make_directODESolve (ExplicitRHS &&ode, std::string tableau, value_type epsTimerel, value_type epsTimeabs, unsigned &number, value_type t0=0., value_type t1=1.)
 Operator that integrates an ODE from 0 to 1 with an adaptive ERK class as timestepper More...
 
template<class Matrix , class Preconditioner , class Container >
InvSqrtODE< Container > dg::mat::make_inv_sqrtodeCG (Matrix &A, const Preconditioner &P, const Container &weights, dg::get_value_type< Container > epsCG)
 Right hand side of the square root ODE. More...
 
template<class MatrixType >
auto dg::mat::make_expode (MatrixType &A)
 Right hand side of the exponential ODE. More...
 
template<class MatrixType >
auto dg::mat::make_besselI0ode (MatrixType &A)
 Right hand side of the (zeroth order) modified Bessel function ODE, rewritten as a system of coupled first order ODEs: More...
 

Detailed Description

\( x \approx f(A)b \)

approximation

Function Documentation

◆ make_besselI0ode()

template<class MatrixType >
auto dg::mat::make_besselI0ode ( MatrixType &  A)

Right hand side of the (zeroth order) modified Bessel function ODE, rewritten as a system of coupled first order ODEs:

\[ \dot{z_0}= z_1 \]

\[ \dot{z_1}= A^2 z_0 - t^{-1} z_1 \]

where \( A\) is the matrix and

\[z=(y,\dot{y})\]

Note
Solution of ODE: \( y(1) = I_0(A) y(0)\) for initial condition \( z(0) = (y(0),0)^T \)

◆ make_directODESolve()

template<class value_type , class ExplicitRHS >
auto dg::mat::make_directODESolve ( ExplicitRHS &&  ode,
std::string  tableau,
value_type  epsTimerel,
value_type  epsTimeabs,
unsigned &  number,
value_type  t0 = 0.,
value_type  t1 = 1. 
)

Operator that integrates an ODE from 0 to 1 with an adaptive ERK class as timestepper

The intended use is to integrate Matrix equations

auto sqrt_ode = dg::mat::make_sqrtode( A, 1., A.weights(), eps);
unsigned number = 0;
auto sqrtA = dg::mat::make_directODESolve( sqrt_ode, "Dormand-Prince-7-4-5",1e-5, 1e-7, number);
dg::apply ( sqrtA , x , b);
void apply(get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y)
centered
auto make_directODESolve(ExplicitRHS &&ode, std::string tableau, value_type epsTimerel, value_type epsTimeabs, unsigned &number, value_type t0=0., value_type t1=1.)
Operator that integrates an ODE from 0 to 1 with an adaptive ERK class as timestepper
Definition: sqrt_ode.h:38

The call \( b = f(x) \) corresponds to integrating \( \dot y = F(y)\) with \( y(0 ) = x\) to \( b = y(1)\)

Parameters
odeThe differential equation to integrate (forwarded to dg::Adaptive<dg::ERKStep>)
tableauThe tableau for dg::ERKStep
epsTimerelrelative accuracy of adaptive ODE solver
epsTimeabsabsolute accuracy of adaptive ODE solver
numberIs linked to the lambda. Contains the number of steps the adaptive timestepper used to completion
t0Change starting time to t0
t1Change end time to t1
Returns
Operator that integrates the ode from t0 to t1
See also
dg::make_sqrtode dg::make_expode, dg::make_besselI0ode

◆ make_expode()

template<class MatrixType >
auto dg::mat::make_expode ( MatrixType &  A)

Right hand side of the exponential ODE.

\[ \dot{y}= A y \]

where \( A\) is the matrix

Note
Solution of ODE: \( y(1) = \exp{A} y(0)\)

◆ make_inv_sqrtodeCG()

template<class Matrix , class Preconditioner , class Container >
InvSqrtODE< Container > dg::mat::make_inv_sqrtodeCG ( Matrix &  A,
const Preconditioner &  P,
const Container &  weights,
dg::get_value_type< Container >  epsCG 
)

Right hand side of the square root ODE.

\[ \dot{y}= \left[tI + (1-t) A\right]^{-1} (I - A)/2 y \]

where \( A\) is the matrix and the inverse is computed via a dg::PCG solver

This class is based on the approach of the paper Numerical approximation of the product of the square root of a matrix with a vector by E. J. Allen et al

Note
Solution of ODE: \( y(1) = 1/\sqrt{A} y(0)\)
Parameters
Aself-adjoint matrix (stored by reference so needs to live)
Pthe preconditioner for the PCG method
weightsWeights for PCG method
epsCGAccuracy for PCG solve