aGrUM  0.16.0
gammaLog2.h
Go to the documentation of this file.
1 
29 #ifndef GUM_GAMMA_LOG2_H
30 #define GUM_GAMMA_LOG2_H
31 
32 #define _USE_MATH_DEFINES // for Visual C++
33 
34 #include <limits>
35 #include <vector>
36 
37 #include <agrum/agrum.h>
38 #include <agrum/core/math/math.h>
39 
40 namespace gum {
41 
48  class GammaLog2 {
49  public:
50  // ============================================================================
52  // ============================================================================
54 
59  GammaLog2(bool requires_precision = false);
60 
65  GammaLog2(const GammaLog2& from);
66 
71  GammaLog2(GammaLog2&& from);
72 
76  ~GammaLog2();
77 
79  // ============================================================================
81  // ============================================================================
83 
88  double operator()(double x) const;
89 
94  void setPrecision(bool p);
95 
97  // ============================================================================
99  // ============================================================================
101 
108  double gammaLog2(double x) const;
109 
111 
112  private:
114  bool __requires_precision{false};
115 
117  static constexpr double __1log2{M_LOG2E};
118 
120  static constexpr double __log_sqrt_2pi{GUM_LOG_SQRT_2PI};
121 
123  static const std::vector< double > __small_values;
124  };
125 
126 } /* namespace gum */
127 
128 #ifndef GUM_NO_INLINE
130 #endif // GUM_NO_INLINE
131 
132 #endif /* GUM_GAMMA_LOG2_H */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
double gammaLog2(double x) const
Returns log2 ( gamma (x) ) for x >= 0.
Definition: gammaLog2_inl.h:32
The class for computing Log2 (Gamma(x))
Definition: gammaLog2.h:48
void setPrecision(bool p)
Sets whether we need more precision for small values.
Definition: gammaLog2_inl.h:59
GammaLog2(bool requires_precision=false)
Default constructor.
Definition: gammaLog2.cpp:39
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
static constexpr double __log_sqrt_2pi
The value of std::log ( std::sqrt(2pi) ).
Definition: gammaLog2.h:120
bool __requires_precision
Indicates whether we need more precision for small values.
Definition: gammaLog2.h:114
#define GUM_LOG_SQRT_2PI
Definition: math.h:48
#define M_LOG2E
Definition: math.h:36
double operator()(double x) const
Returns log2 ( gamma (x) ) for x > 0.
Definition: gammaLog2_inl.h:55
~GammaLog2()
Class destructor.
Definition: gammaLog2.cpp:57
static const std::vector< double > __small_values
The 5000 values from 0 to 50 by step of 1/100.
Definition: gammaLog2.h:123
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
static constexpr double __1log2
The value of 1 / std::log(2).
Definition: gammaLog2.h:117