Loading [MathJax]/extensions/tex2jax.js
Thrill  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ZipfDistribution Class Reference

Detailed Description

A class for producing random integers distributed according to the Zipf-Mandelbrot probability mass function:

p(k;N,q,s) = 1/( H(N,q,s)*(k+q)^s )

where H(N,q,s) = sum_(n=1)^(N) 1/(n+q)^s

and s > 1, q >= 0, N > 1.

When q = 0 this becomes the mass function for Zipf's Law When N -> infinity this becomes the Hurwitz Zeta mass function When N -> infinity and q = 0, this becomes the Riemann Zeta mass function

Definition at line 70 of file zipf_distribution.hpp.

#include <zipf_distribution.hpp>

Public Member Functions

 ZipfDistribution ()=default
 create uninitialized object. be careful. More...
 
 ZipfDistribution (const size_t N, const double s, const double q=0)
 Creates a new Zipf-Mandelbrot distribution given s, q, N. More...
 
size_t max () const
 maximum value (inclusive) of distribution More...
 
size_t min () const
 minimum value of distribution More...
 
size_t N () const
 deliver population size More...
 
template<typename Engine >
size_t operator() (Engine &eng)
 pick next random number in the range [1,num) More...
 
double q () const
 parameter of distribution More...
 
double s () const
 parameter of distribution More...
 

Private Types

using dist_type = std::discrete_distribution< size_t >
 

Static Private Member Functions

static dist_type make_dist (size_t N, double s, double q)
 

Private Attributes

dist_type dist_
 
size_t N_
 
double q_
 
double s_
 

Member Typedef Documentation

◆ dist_type

using dist_type = std::discrete_distribution<size_t>
private

Definition at line 116 of file zipf_distribution.hpp.

Constructor & Destructor Documentation

◆ ZipfDistribution() [1/2]

ZipfDistribution ( )
default

create uninitialized object. be careful.

◆ ZipfDistribution() [2/2]

ZipfDistribution ( const size_t  N,
const double  s,
const double  q = 0 
)
inline

Creates a new Zipf-Mandelbrot distribution given s, q, N.

p(k;N,q,s) = 1/( H(N,q,s)*(k+q)^s )

where H(N,q,s) = sum_(n=1)^(N) 1/(n+q)^s

and s > 1, q >= 0, N > 1

Only N and s needs to be specified. The default for q is 0.

Definition at line 88 of file zipf_distribution.hpp.

Member Function Documentation

◆ make_dist()

static dist_type make_dist ( size_t  N,
double  s,
double  q 
)
inlinestaticprivate

Definition at line 119 of file zipf_distribution.hpp.

References LOG1, and ZipfDistribution::N().

◆ max()

size_t max ( ) const
inline

maximum value (inclusive) of distribution

Definition at line 109 of file zipf_distribution.hpp.

References ZipfDistribution::N_.

◆ min()

size_t min ( ) const
inline

minimum value of distribution

Definition at line 106 of file zipf_distribution.hpp.

◆ N()

size_t N ( ) const
inline

deliver population size

Definition at line 97 of file zipf_distribution.hpp.

References ZipfDistribution::N_.

Referenced by ZipfDistribution::make_dist().

◆ operator()()

size_t operator() ( Engine &  eng)
inline

pick next random number in the range [1,num)

Definition at line 94 of file zipf_distribution.hpp.

References ZipfDistribution::dist_.

◆ q()

double q ( ) const
inline

parameter of distribution

Definition at line 100 of file zipf_distribution.hpp.

References ZipfDistribution::q_.

◆ s()

double s ( ) const
inline

parameter of distribution

Definition at line 103 of file zipf_distribution.hpp.

References ZipfDistribution::s_.

Member Data Documentation

◆ dist_

dist_type dist_
private

Definition at line 117 of file zipf_distribution.hpp.

Referenced by ZipfDistribution::operator()().

◆ N_

size_t N_
private

Definition at line 112 of file zipf_distribution.hpp.

Referenced by ZipfDistribution::max(), and ZipfDistribution::N().

◆ q_

double q_
private

Definition at line 114 of file zipf_distribution.hpp.

Referenced by ZipfDistribution::q().

◆ s_

double s_
private

Definition at line 113 of file zipf_distribution.hpp.

Referenced by ZipfDistribution::s().


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