aGrUM  0.20.3
a C++ library for (probabilistic) graphical models

All the maths you'll need. More...

+ Collaboration diagram for Math:

Detailed Description

All the maths you'll need.

Classes

class  gum::Formula
 Evaluates a string as a algebraic formula. More...
 
class  gum::Chi2
 Represent the chi2 distribution. More...
 
class  gum::Dirichlet
 A class for sampling w.r.t. More...
 
class  gum::FormulaPart
 Represents part of a formula. More...
 
class  gum::GammaLog2
 The class for computing Log2 (Gamma(x)) More...
 
class  gum::Rational< GUM_SCALAR >
 Class template used to approximate decimal numbers by rationals. More...
 
class  gum::VariableLog2ParamComplexity< ALLOC >
 the class for computing the log2 of the parametric complexity of an r-ary multinomial variableThis class enables to compute the log in base 2 of the parametric complexity of a single r-ary multinomial variable, i.e., the log in base 2 of the C_N^r term used by NML scores in Bayesian network structure learning algorithm (see, e.g., Silander, Roos, Kontkanen and Myllymaki (2007) "Factorized Normalized Maximum " Likelihood Criterion for Learning Bayesian network Structures)" More...
 

Integers Pow utility methods

unsigned long gum::intPow (unsigned long base, unsigned long exponent)
 Specialized pow function with integers (faster implementation). More...
 
unsigned long gum::int2Pow (unsigned long exponent)
 Specialized base 2 pow function with integer. More...
 
void gum::superiorPow (unsigned long card, unsigned long &num_bits, unsigned long &new_card)
 Compute the superior and closest power of two of an integer. More...
 

Function Documentation

◆ int2Pow()

INLINE unsigned long gum::int2Pow ( unsigned long  exponent)

Specialized base 2 pow function with integer.

Parameters
exponentThe unsigned long integer exponent used to compute \( 2^{exponent} \) which will hold the result of afterward.

Definition at line 48 of file pow_inl.h.

References gum::Set< Key, Alloc >::emplace().

48 { return 1UL << exponent; }
+ Here is the call graph for this function:

◆ intPow()

INLINE unsigned long gum::intPow ( unsigned long  base,
unsigned long  exponent 
)

Specialized pow function with integers (faster implementation).

Parameters
baseThe constant unsigned long integer base used to compute \( base^{exponent} \).
exponentThe unsigned long integer exponent used which will hold the result afterward.

Definition at line 35 of file pow_inl.h.

References gum::Set< Key, Alloc >::emplace().

35  {
36  if (exponent == 0) { return 1UL; }
37 
38  unsigned long out = base;
39 
40  for (unsigned long i = 1; i < exponent; i++)
41  out *= base;
42 
43  return out;
44  }
+ Here is the call graph for this function:

◆ superiorPow()

INLINE void gum::superiorPow ( unsigned long  card,
unsigned long &  num_bits,
unsigned long &  new_card 
)

Compute the superior and closest power of two of an integer.

Given an integer, compute it's - superior - and closest power of two, i.e. the number of bits necessary to represent this integer as well as the maximum integer that can be represented by those bits.

Parameters
cardThe constant unsigned long integer we wish to represent by bits.
num_bitsThe unsigned long integer used as a "return" value to get the minimum number of bits used to represend card.
new_cardThe unsigned long integer used as a "return" value to get the maximum number those bits can represent, i.e. \( 2^{num\_bits} \).

Definition at line 54 of file pow_inl.h.

References gum::Set< Key, Alloc >::emplace().

54  {
55  if (card == 0) {
56  num_bits = 0;
57  new_card = 1;
58  return;
59  }
60 
61  num_bits = 1;
62  new_card = 2;
63 
64  while (new_card < card) {
65  new_card *= 2;
66  num_bits++;
67  }
68  }
+ Here is the call graph for this function: