numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::functions::impl::gamma_lanczos< Real > Class Template Reference

Class to calculate gamma function using approximation derived by Lanczos [20]. More...

#include <num_collect/functions/impl/gamma_lanczos.h>

+ Collaboration diagram for num_collect::functions::impl::gamma_lanczos< Real >:

Static Public Member Functions

template<typename T >
requires ( std::is_same_v<T, Real> || std::is_same_v<T, std::complex<Real>>)
static constexpr auto gamma (T x) -> T
 Calculate a value of gamma function.
 
static constexpr auto log_gamma (Real x) -> Real
 Calculate a natural logarithm of a value of gamma function.
 

Static Public Attributes

static constexpr std::array< Real, num_coeffscoeffs
 Coefficients.
 
static constexpr auto constant = static_cast<Real>(0.999999999999997092)
 Constant term.
 
static constexpr std::size_t num_coeffs = 14
 Number of coefficients.
 
static constexpr auto rational
 Rational for parameter.
 
static constexpr auto series_coeff = static_cast<Real>(2.5066282746310005)
 Coefficient for the series.
 

Detailed Description

template<base::concepts::real_scalar Real>
class num_collect::functions::impl::gamma_lanczos< Real >

Class to calculate gamma function using approximation derived by Lanczos [20].

Definition at line 38 of file gamma_lanczos.h.

Member Function Documentation

◆ gamma()

template<base::concepts::real_scalar Real>
template<typename T >
requires ( std::is_same_v<T, Real> || std::is_same_v<T, std::complex<Real>>)
static constexpr auto num_collect::functions::impl::gamma_lanczos< Real >::gamma ( T x) -> T
inlinestaticnodiscardconstexpr

Calculate a value of gamma function.

Template Parameters
TType of the argument.
Parameters
[in]xArgument.
Returns
Value of gamma function.

Definition at line 80 of file gamma_lanczos.h.

◆ log_gamma()

template<base::concepts::real_scalar Real>
static constexpr auto num_collect::functions::impl::gamma_lanczos< Real >::log_gamma ( Real x) -> Real
inlinestaticnodiscardconstexpr

Calculate a natural logarithm of a value of gamma function.

Parameters
[in]xArgument.
Returns
Natural logarithm of the value of gamma function.

Definition at line 99 of file gamma_lanczos.h.

Member Data Documentation

◆ coeffs

template<base::concepts::real_scalar Real>
std::array<Real, num_coeffs> num_collect::functions::impl::gamma_lanczos< Real >::coeffs
staticconstexpr
Initial value:
{
static_cast<Real>(57.1562356658629235),
static_cast<Real>(-59.5979603554754912),
static_cast<Real>(14.1360979747417471),
static_cast<Real>(-0.491913816097620199),
static_cast<Real>(0.339946499848118887e-4),
static_cast<Real>(0.465236289270485756e-4),
static_cast<Real>(-0.983744753048795646e-4),
static_cast<Real>(0.158088703224912494e-3),
static_cast<Real>(-0.210264441724104883e-3),
static_cast<Real>(0.217439618115212643e-3),
static_cast<Real>(-0.164318106536762890e-3),
static_cast<Real>(0.844182239838527433e-4),
static_cast<Real>(-0.261908384015814087e-4),
static_cast<Real>(0.368991826295316234e-5)}

Coefficients.

Definition at line 44 of file gamma_lanczos.h.

◆ constant

template<base::concepts::real_scalar Real>
auto num_collect::functions::impl::gamma_lanczos< Real >::constant = static_cast<Real>(0.999999999999997092)
staticconstexpr

Constant term.

Definition at line 61 of file gamma_lanczos.h.

◆ num_coeffs

template<base::concepts::real_scalar Real>
std::size_t num_collect::functions::impl::gamma_lanczos< Real >::num_coeffs = 14
staticconstexpr

Number of coefficients.

Definition at line 41 of file gamma_lanczos.h.

◆ rational

template<base::concepts::real_scalar Real>
auto num_collect::functions::impl::gamma_lanczos< Real >::rational
staticconstexpr
Initial value:
=
static_cast<Real>(671) / static_cast<Real>(128)

Rational for parameter.

Definition at line 67 of file gamma_lanczos.h.

◆ series_coeff

template<base::concepts::real_scalar Real>
auto num_collect::functions::impl::gamma_lanczos< Real >::series_coeff = static_cast<Real>(2.5066282746310005)
staticconstexpr

Coefficient for the series.

Definition at line 64 of file gamma_lanczos.h.


The documentation for this class was generated from the following file: