Thrill  0.1
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()

Sampling ( RNG &  rng)
inlineexplicit

Definition at line 38 of file sampling.hpp.

Member Function Documentation

◆ do_sample()

void do_sample ( Iterator  begin,
Iterator  end,
size_t  size,
OutputIterator  out_begin 
)
inlineprivate

◆ hash_sample()

void hash_sample ( Iterator  begin,
Iterator  end,
size_t  size,
OutIterator  out_begin 
)
inlineprivate

◆ operator()() [1/2]

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().

◆ operator()() [2/2]

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

◆ debug

constexpr bool debug = false
static

Definition at line 36 of file sampling.hpp.

◆ hash_table

std::vector<size_t> hash_table
private

Definition at line 163 of file sampling.hpp.

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

◆ hyp_

common::hypergeometric hyp_
private

Definition at line 162 of file sampling.hpp.

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

◆ indices

std::vector<size_t> indices
private

Definition at line 163 of file sampling.hpp.

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

◆ rng_

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: