Thrill
0.1
|
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.
#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_ |
|
inlineexplicit |
Definition at line 38 of file sampling.hpp.
|
inlineprivate |
Definition at line 56 of file sampling.hpp.
References Sampling< RNG >::hash_sample(), Sampling< RNG >::hyp_, Sampling< RNG >::rng_, and sLOG.
Referenced by Sampling< RNG >::operator()().
|
inlineprivate |
Definition at line 96 of file sampling.hpp.
References Sampling< RNG >::hash_table, Sampling< RNG >::indices, tlx::integer_log2_ceil(), Sampling< RNG >::rng_, sLOG, and TLX_LIKELY.
Referenced by Sampling< RNG >::do_sample().
|
inline |
Definition at line 42 of file sampling.hpp.
References Sampling< RNG >::do_sample().
|
inline |
Definition at line 49 of file sampling.hpp.
References Sampling< RNG >::do_sample().
|
static |
Definition at line 36 of file sampling.hpp.
|
private |
Definition at line 163 of file sampling.hpp.
Referenced by Sampling< RNG >::hash_sample().
|
private |
Definition at line 162 of file sampling.hpp.
Referenced by Sampling< RNG >::do_sample().
|
private |
Definition at line 163 of file sampling.hpp.
Referenced by Sampling< RNG >::hash_sample().
|
private |
Definition at line 161 of file sampling.hpp.
Referenced by Sampling< RNG >::do_sample(), and Sampling< RNG >::hash_sample().