Extension: Matrix functions
#include "dg/matrix/matrix.h"
functors.h
Go to the documentation of this file.
1#pragma once
2#include <boost/math/special_functions.hpp>
3namespace dg {
4namespace mat {
10template < class T = double>
12{
21 T operator() ( T x) const
22 {
23 return boost::math::cyl_bessel_i(0, x);
24 }
25};
31template < class T = double>
32struct GAMMA0
33{
34 GAMMA0( ) {}
42 T operator() ( T x) const
43 {
44 return exp(x)*boost::math::cyl_bessel_i(0, x);
45 }
46};
47
48
55template<class T>
56T phi1( T x){
57 if ( fabs( x) < 1e-16 )
58 return 1.;
59 if ( fabs(x) < 1)
60 return expm1( x)/x;
61 return (exp( x) - 1)/x;
62}
63
70template<class T>
71T phi2( T x){
72 if ( fabs( x) < 1e-16 )
73 return 1./2;
74 if ( fabs(x) < 1e-2)
75 return 1./2.+x*(1./6.+x*(1./24. + x/120.));
76 return ((exp( x) - 1)/x - 1)/x;
77}
78
85template<class T>
86T phi3( T x){
87 if ( fabs( x) < 1e-16 )
88 return 1./6.;
89 if ( fabs(x) < 1e-2)
90 return 1./6. + x*(1./24.+x*(1./120. +x/720.));
91 return (((exp( x) - 1)/x - 1)/x-1./2.)/x;
92}
99template<class T>
100T phi4( T x){
101 if ( fabs( x) < 1e-16 )
102 return 1./24.;
103 if ( fabs(x) < 1e-2)
104 return 1./24. + x*(1./120.+x*(1./720. + x/5040));
105 return ((((exp( x) - 1)/x - 1)/x-1./2.)/x-1./6.)/x;
106}
107
108}//namespace mat
109}//namespace dg
T phi1(T x)
Definition: functors.h:56
T phi3(T x)
Definition: functors.h:86
T phi4(T x)
Definition: functors.h:100
T phi2(T x)
Definition: functors.h:71
Classes for Krylov space approximations of a Matrix-Vector product.
with the zeroth order modified Bessel function
Definition: functors.h:12
T operator()(T x) const
return with the zeroth order modified Bessel function
Definition: functors.h:21
BESSELI0()
Definition: functors.h:13
with the zeroth order modified Bessel function
Definition: functors.h:33
GAMMA0()
Definition: functors.h:34
T operator()(T x) const
return with the zeroth order modified Bessel function
Definition: functors.h:42