This module presents the functionalities offered by TRSL. More...
This module presents the functionalities offered by TRSL.
Systematic sampling is provided through trsl::is_picked_systematic, a predicate functor to use in combination with trsl::persistent_filter_iterator to form a sample iterator. The sample iterator accesses a population of elements through a range defined by a pair of Forward Iterators (begin/end), and provides on-the-fly iteration through a sample of the population.
Systematic sampling may perform very badly if the order in which the input population is presented is following a pattern. If a pattern is likely to occur in the population, the user may want to pipe the sample iterator after a trsl::random_permutation_iterator, or use is_picked_systematic with ppfilter_iterator. The resulting iterator effectively implements probability sampling. The price to pay for probability sampling is a Random Access Iterator. While persistent_filter_iterator will work e.g. with std::list
, ppfilter_iterator requires e.g. std::vector
or std::deque
.
Iteration through an index-based reordering of a range can be obtained with trsl::reorder_iterator. TRSL provides several functions that generate reorder iterators for common reorderings.
trsl::random_permutation_iterator provides an iterator over a random permutation of a range.
trsl::sort_iterator provides an iterator over a sorted permutation of a range.