trsl logo


This module presents the functionalities offered by TRSL.

Systematic Sampling

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.

See also:
trsl_example1.cpp for a basic example.
trsl::is_picked_systematic, trsl::persistent_filter_iterator, trsl::ppfilter_iterator.

Range Reordering

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.

Random Permutation

trsl::random_permutation_iterator provides an iterator over a random permutation of a range.

trsl::reorder_iterator, trsl::random_permutation_iterator.
See also:
trsl_example2.cpp for a basic example.

Sorted Permutation

trsl::sort_iterator provides an iterator over a sorted permutation of a range.

trsl::reorder_iterator, trsl::sort_iterator.

© Copyright 2007-2011 Renaud Detry.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
Revised Wed Apr 6 16:30:07 2011. Logo