21 #ifndef RFFGEN_CMATH_LOG_HH
22 #define RFFGEN_CMATH_LOG_HH
25 #include "../Util/base.hh"
26 #include "../Util/chainer.hh"
27 #include "../Util/exceptions.hh"
43 using Chainer<LN>::operator ();
54 #ifdef RFFGEN_ENABLE_EXCEPTIONS
62 double d0() const noexcept
69 double d1(
double dx = 1.)
const
75 template <
int = -1 ,
int = -1 >
76 double d2(
double dx = 1.,
double dy = 1.)
const
78 return - x_inv * x_inv * dx * dy;
82 template <
int = -1 ,
int = -1 ,
int = -1 >
83 double d3(
double dx = 1.,
double dy = 1.,
double dz = 1.)
const
85 return 2 * x_inv * x_inv * x_inv * dx * dy * dz;
89 double value = 0., x_inv = 1.;
102 using Chainer<Log10>::operator ();
113 #ifdef RFFGEN_ENABLE_EXCEPTIONS
121 double d0() const noexcept
127 template <
int = -1 >
128 double d1(
double dx = 1.)
const
130 return ln10inv * x_inv * dx;
134 template <
int = -1 ,
int = -1 >
135 double d2(
double dx = 1.,
double dy = 1.)
const
137 return - ln10inv * x_inv * x_inv * dx * dy;
141 template <
int = -1 ,
int = -1 ,
int = -1 >
142 double d3(
double dx = 1.,
double dy = 1.,
double dz = 1.)
const
144 return 2 * ln10inv * x_inv * x_inv * x_inv * dx * dy * dz;
148 double value = 0., x_inv = 1., ln10inv = 1/log(10.);
161 using Chainer<Log2>::operator ();
172 #ifdef RFFGEN_ENABLE_EXCEPTIONS
180 double d0() const noexcept
186 template <
int = -1 >
187 double d1(
double dx = 1.)
const
189 return ln2inv * x_inv * dx;
193 template <
int = -1 ,
int = -1 >
194 double d2(
double dx = 1.,
double dy = 1.)
const
196 return - ln2inv * x_inv * x_inv * dx * dy;
200 template <
int = -1 ,
int = -1 ,
int = -1 >
201 double d3(
double dx = 1.,
double dy = 1.,
double dz = 1.)
const
203 return 2 * ln2inv * x_inv * x_inv * x_inv * dx * dy * dz;
207 double value = 0., x_inv = 1., ln2inv = 1/log(2.);
214 template <class Function, class = std::enable_if_t<std::is_base_of<Base,Function>::value> >
215 auto ln(
const Function& f)
224 template <class Function, class = std::enable_if_t<std::is_base_of<Base,Function>::value> >
225 auto log10(
const Function& f)
234 template <class Function, class = std::enable_if_t<std::is_base_of<Base,Function>::value> >
235 auto log2(
const Function& f)
242 #endif // RFFGEN_CMATH_LOG_HH
Log2(double x=1.)
Constructor.
Definition: log.hh:167
double d3(double dx=1., double dy=1., double dz=1.) const
Third (directional) derivative.
Definition: log.hh:201
double d1(double dx=1.) const
First (directional) derivative.
Definition: log.hh:187
double d3(double dx=1., double dy=1., double dz=1.) const
Third (directional) derivative.
Definition: log.hh:83
double d0() const noexcept
Function value.
Definition: log.hh:62
void update(double x)
Reset point of evaluation.
Definition: log.hh:170
Base class for functions satisfying FunctionConcept. Required for enabling the operators in generate...
Definition: base.hh:27
double d3(double dx=1., double dy=1., double dz=1.) const
Third (directional) derivative.
Definition: log.hh:142
void update(double x)
Reset point of evaluation.
Definition: log.hh:111
double d0() const noexcept
Function value.
Definition: log.hh:121
Natural logarithm including first three derivatives.
Definition: log.hh:41
double d2(double dx=1., double dy=1.) const
Second (directional) derivative.
Definition: log.hh:135
double d2(double dx=1., double dy=1.) const
Second (directional) derivative.
Definition: log.hh:194
Exception for scalar function arguments that are outside the domain of the function.
Definition: exceptions.hh:40
LN(double x=1.)
Constructor.
Definition: log.hh:49
void update(double x)
Reset point of evaluation.
Definition: log.hh:52
Common (base 10) logarithm including first three derivatives.
Definition: log.hh:100
double d1(double dx=1.) const
First (directional) derivative.
Definition: log.hh:69
Base 2 logarithm including first three derivatives.
Definition: log.hh:159
double d1(double dx=1.) const
First (directional) derivative.
Definition: log.hh:128
Log10(double x=1.)
Constructor.
Definition: log.hh:108
double d0() const noexcept
Function value.
Definition: log.hh:180
double d2(double dx=1., double dy=1.) const
Second (directional) derivative.
Definition: log.hh:76