Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sampling< RNG > Class Template Reference

Detailed Description

template<typename RNG = std::mt19937_64>
class thrill::common::Sampling< RNG >

Sampling without replacement, implementing Algorithm R from Sanders, Lamm, Hübschle-Schneider, Schrade, Dachsbacher, ACM TOMS 2017: Efficient Random Sampling - Parallel, Vectorized, Cache-Efficient, and Online

Definition at line 33 of file sampling.hpp.

+ Collaboration diagram for Sampling< RNG >:

#include <sampling.hpp>

Public Member Functions

 Sampling (RNG &rng)
 
template<typename Iterator , typename Type = typename std::iterator_traits<Iterator>::value_type>
void operator() (Iterator begin, Iterator end, size_t size, std::vector< Type > &samples)
 
template<typename Iterator , typename OutputIterator >
void operator() (Iterator begin, Iterator end, size_t size, OutputIterator out_begin)
 

Static Public Attributes

static constexpr bool debug = false
 

Private Member Functions

template<typename Iterator , typename OutputIterator >
void do_sample (Iterator begin, Iterator end, size_t size, OutputIterator out_begin)
 
template<typename Iterator , typename OutIterator , typename Type = typename std::iterator_traits<Iterator>::value_type>
void hash_sample (Iterator begin, Iterator end, size_t size, OutIterator out_begin)
 

Private Attributes

std::vector< size_t > hash_table
 
common::hypergeometric hyp_
 
std::vector< size_t > indices
 
RNG & rng_
 

Constructor & Destructor Documentation

Sampling ( RNG &  rng)
inlineexplicit

Definition at line 38 of file sampling.hpp.

Member Function Documentation

void do_sample ( Iterator  begin,
Iterator  end,
size_t  size,
OutputIterator  out_begin 
)
inlineprivate
void hash_sample ( Iterator  begin,
Iterator  end,
size_t  size,
OutIterator  out_begin 
)
inlineprivate
void operator() ( Iterator  begin,
Iterator  end,
size_t  size,
std::vector< Type > &  samples 
)
inline

Definition at line 42 of file sampling.hpp.

References Sampling< RNG >::do_sample().

void operator() ( Iterator  begin,
Iterator  end,
size_t  size,
OutputIterator  out_begin 
)
inline

Definition at line 49 of file sampling.hpp.

References Sampling< RNG >::do_sample().

Member Data Documentation

constexpr bool debug = false
static

Definition at line 36 of file sampling.hpp.

std::vector<size_t> hash_table
private

Definition at line 163 of file sampling.hpp.

Referenced by Sampling< RNG >::hash_sample().

common::hypergeometric hyp_
private

Definition at line 162 of file sampling.hpp.

Referenced by Sampling< RNG >::do_sample().

std::vector<size_t> indices
private

Definition at line 163 of file sampling.hpp.

Referenced by Sampling< RNG >::hash_sample().

RNG& rng_
private

Definition at line 161 of file sampling.hpp.

Referenced by Sampling< RNG >::do_sample(), and Sampling< RNG >::hash_sample().


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