STXXL
1.4.0
|
Algorithms with STL-compatible interface. More...
Namespaces | |
stxxl::ksort_local | |
stxxl::sort_local | |
stxxl::stable_ksort_local | |
Classes | |
struct | stxxl::ksort_defaultkey< record_type > |
Functions | |
template<typename ExtIterator , typename EqualityComparable > | |
ExtIterator | stxxl::find (ExtIterator begin, ExtIterator end, const EqualityComparable &value, int_type nbuffers=0) |
External equivalent of std::find, see stxxl::find. More... | |
template<typename ExtIterator , typename UnaryFunction > | |
UnaryFunction | stxxl::for_each (ExtIterator begin, ExtIterator end, UnaryFunction functor, int_type nbuffers=0) |
External equivalent of std::for_each, see stxxl::for_each. More... | |
template<typename ExtIterator , typename UnaryFunction > | |
UnaryFunction | stxxl::for_each_m (ExtIterator begin, ExtIterator end, UnaryFunction functor, int_type nbuffers=0) |
External equivalent of std::for_each (mutating), see stxxl::for_each_m (mutating). More... | |
template<typename ExtIterator , typename Generator > | |
void | stxxl::generate (ExtIterator begin, ExtIterator end, Generator generator, int_type nbuffers=0) |
External equivalent of std::generate, see stxxl::generate. More... | |
template<typename ExtIterator , typename KeyExtractor > | |
void | stxxl::ksort (ExtIterator first, ExtIterator last, KeyExtractor keyobj, unsigned_type M) |
Sort records with integer keys, see stxxl::ksort -- Sorting Integer Keys. More... | |
template<typename ExtIterator > | |
void | stxxl::ksort (ExtIterator first, ExtIterator last, unsigned_type M) |
Sort records with integer keys, see stxxl::ksort -- Sorting Integer Keys. More... | |
template<typename ExtIterator_ , typename RandomNumberGenerator_ , unsigned BlockSize_, unsigned PageSize_, typename AllocStrategy_ > | |
void | stxxl::random_shuffle (ExtIterator_ first, ExtIterator_ last, RandomNumberGenerator_ &rand, unsigned_type M, AllocStrategy_ AS=STXXL_DEFAULT_ALLOC_STRATEGY()) |
External equivalent of std::random_shuffle. More... | |
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_, typename RandomNumberGenerator_ > | |
void | stxxl::random_shuffle (stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > first, stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > last, RandomNumberGenerator_ &rand, unsigned_type M) |
External equivalent of std::random_shuffle (specialization for stxxl::vector) More... | |
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_> | |
void | stxxl::random_shuffle (stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > first, stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > last, unsigned_type M) |
External equivalent of std::random_shuffle (specialization for stxxl::vector) More... | |
template<typename ExtIterator , typename StrictWeakOrdering > | |
void | stxxl::sort (ExtIterator first, ExtIterator last, StrictWeakOrdering cmp, unsigned_type M) |
Sort records comparison-based, see stxxl::sort -- Sorting Comparison-Based. More... | |
template<unsigned BlockSize, class RandomAccessIterator , class CmpType , class AllocStr > | |
void | stxxl::sort (RandomAccessIterator begin, RandomAccessIterator end, CmpType cmp, unsigned_type MemSize, AllocStr AS) |
Sorts range of any random access iterators externally. More... | |
template<typename ExtIterator_ > | |
void | stxxl::stable_ksort (ExtIterator_ first, ExtIterator_ last, unsigned_type M) |
Sort records with integer keys. More... | |
Algorithms with STL-compatible interface.
ExtIterator stxxl::find | ( | ExtIterator | begin, |
ExtIterator | end, | ||
const EqualityComparable & | value, | ||
int_type | nbuffers = 0 |
||
) |
External equivalent of std::find, see stxxl::find.
Returns the first iterator i in the range [first, last) such that *i == value
. Returns last if no such iterator exists. To overlap I/O and computation nbuffers
are used (a value at least D is recommended). The size of the buffers is derived from the container that is pointed by the iterators.
begin | object of model of ext_random_access_iterator concept |
end | object of model of ext_random_access_iterator concept |
value | value that is equality comparable to the ExtIterator's value type |
nbuffers | number of buffers (blocks) for internal use (should be at least 2*D) |
i
in the range [begin,end) such that *( i
) == value
, if no such exists then end
Definition at line 274 of file scan.h.
Referenced by stxxl::request_queue_impl_1q::cancel_request(), stxxl::request_queue_impl_qwqr::cancel_request(), and stxxl::btree::btree< KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy >::count().
UnaryFunction stxxl::for_each | ( | ExtIterator | begin, |
ExtIterator | end, | ||
UnaryFunction | functor, | ||
int_type | nbuffers = 0 |
||
) |
External equivalent of std::for_each, see stxxl::for_each.
stxxl::for_each applies the function object functor
to each element in the range [first, last); functor's
return value, if any, is ignored. Applications are performed in forward order, i.e. from first to last. stxxl::for_each returns the function object after it has been applied to each element. To overlap I/O and computation nbuffers
used (a value at least D is recommended). The size of the buffers is derived from the container that is pointed by the iterators.
begin | object of model of ext_random_access_iterator concept |
end | object of model of ext_random_access_iterator concept |
functor | function object of model of std::UnaryFunction concept |
nbuffers | number of buffers (blocks) for internal use (should be at least 2*D ) |
functor
after it has been applied to the each element of the given rangeDefinition at line 51 of file scan.h.
Referenced by stxxl::request_with_waiters::notify_waiters().
UnaryFunction stxxl::for_each_m | ( | ExtIterator | begin, |
ExtIterator | end, | ||
UnaryFunction | functor, | ||
int_type | nbuffers = 0 |
||
) |
External equivalent of std::for_each (mutating), see stxxl::for_each_m (mutating).
stxxl::for_each_m applies the function object functor
to each element in the range [first, last); functor's
return value, if any, is ignored. Applications are performed in forward order, i.e. from first to last. stxxl::for_each_m returns the function object after it has been applied to each element. To overlap I/O and computation nbuffers
are used (a value at least 2D is recommended). The size of the buffers is derived from the container that is pointed by the iterators.
begin | object of model of ext_random_access_iterator concept |
end | object of model of ext_random_access_iterator concept |
functor | object of model of std::UnaryFunction concept |
nbuffers | number of buffers (blocks) for internal use (should be at least 2*D ) |
functor
after it has been applied to the each element of the given rangeDefinition at line 121 of file scan.h.
References stxxl::buf_ostream< BlockType, BIDIteratorType >::flush().
void stxxl::generate | ( | ExtIterator | begin, |
ExtIterator | end, | ||
Generator | generator, | ||
int_type | nbuffers = 0 |
||
) |
External equivalent of std::generate, see stxxl::generate.
Generate assigns the result of invoking generator
, a function object that takes no arguments, to each element in the range [first, last). To overlap I/O and computation nbuffers
are used (a value at least D is recommended). The size of the buffers is derived from the container that is pointed by the iterators.
begin | object of model of ext_random_access_iterator concept |
end | object of model of ext_random_access_iterator concept |
generator | function object of model of std::generator concept |
nbuffers | number of buffers (blocks) for internal use (should be at least 2*D, or zero for automaticl 2*D) |
void stxxl::ksort | ( | ExtIterator | first, |
ExtIterator | last, | ||
KeyExtractor | keyobj, | ||
unsigned_type | M | ||
) |
Sort records with integer keys, see stxxl::ksort -- Sorting Integer Keys.
stxxl::ksort sorts the elements in [first, last) into ascending order, meaning that if i
and j
are any two valid iterators in [first, last) such that i
precedes j
, then *j
is not less than *i
. Note: as std::sort and stxxl::sort, stxxl::ksort is not guaranteed to be stable. That is, suppose that *i
and *j
are equivalent: neither one is less than the other. It is not guaranteed that the relative order of these two elements will be preserved by stxxl::ksort.
The two versions of stxxl::ksort differ in how they define whether one element is less than another. The first version assumes that the elements have key()
member function that returns an integral key (32 or 64 bit), as well as the minimum and the maximum element values. The second version compares objects extracting the keys using keyobj
object, that is in turn provides min and max element values.
The sorter's internal memory consumption is bounded by M
bytes.
first | object of model of ext_random_access_iterator concept |
last | object of model of ext_random_access_iterator concept |
keyobj | key extractor object |
M | amount of memory for internal use (in bytes) |
Definition at line 731 of file ksort.h.
References stxxl::block_manager::delete_block(), stxxl::is_sorted(), stxxl::ksort_local::ksort_blocks(), stxxl::block_manager::new_block(), stxxl::stl_in_memory_sort(), STXXL_ASSERT, stxxl::request_interface::wait(), and stxxl::wait_all().
Referenced by stxxl::ksort().
void stxxl::ksort | ( | ExtIterator | first, |
ExtIterator | last, | ||
unsigned_type | M | ||
) |
Sort records with integer keys, see stxxl::ksort -- Sorting Integer Keys.
stxxl::ksort sorts the elements in [first, last) into ascending order, meaning that if i
and j
are any two valid iterators in [first, last) such that i
precedes j
, then *j
is not less than *i
. Note: as std::sort and stxxl::sort, stxxl::ksort is not guaranteed to be stable. That is, suppose that *i
and *j
are equivalent: neither one is less than the other. It is not guaranteed that the relative order of these two elements will be preserved by stxxl::ksort.
first | object of model of ext_random_access_iterator concept |
last | object of model of ext_random_access_iterator concept |
M | amount of buffers for internal use |
Definition at line 1086 of file ksort.h.
References stxxl::ksort().
void stxxl::random_shuffle | ( | ExtIterator_ | first, |
ExtIterator_ | last, | ||
RandomNumberGenerator_ & | rand, | ||
unsigned_type | M, | ||
AllocStrategy_ | AS = STXXL_DEFAULT_ALLOC_STRATEGY() |
||
) |
External equivalent of std::random_shuffle.
first | begin of the range to shuffle |
last | end of the range to shuffle |
rand | random number generator object (functor) |
M | number of bytes for internal use |
AS | parallel disk allocation strategy |
Definition at line 49 of file random_shuffle.h.
References stxxl::external, stxxl::grow_shrink2, stxxl::read_write_pool< BlockType >::resize_prefetch(), stxxl::read_write_pool< BlockType >::resize_write(), stxxl::stream::streamify(), STXXL_ERRMSG, STXXL_STATIC_ASSERT, stxxl::STXXL_UNUSED(), and STXXL_VERBOSE1.
Referenced by stxxl::RC::init(), stxxl::interleaved_RC::interleaved_RC(), and stxxl::random_shuffle().
void stxxl::random_shuffle | ( | stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > | first, |
stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > | last, | ||
RandomNumberGenerator_ & | rand, | ||
unsigned_type | M | ||
) |
External equivalent of std::random_shuffle (specialization for stxxl::vector)
first | begin of the range to shuffle |
last | end of the range to shuffle |
rand | random number generator object (functor) |
M | number of bytes for internal use |
Definition at line 196 of file random_shuffle.h.
References stxxl::vector_iterator< ValueType, AllocStr, SizeType, DiffType, BlockSize, PagerType, PageSize >::bid(), stxxl::vector_iterator< ValueType, AllocStr, SizeType, DiffType, BlockSize, PagerType, PageSize >::block_offset(), stxxl::external, stxxl::buf_ostream< BlockType, BIDIteratorType >::flush(), stxxl::grow_shrink2, stxxl::random_shuffle(), stxxl::read_write_pool< BlockType >::resize_prefetch(), stxxl::read_write_pool< BlockType >::resize_write(), STXXL_ERRMSG, and STXXL_VERBOSE1.
|
inline |
External equivalent of std::random_shuffle (specialization for stxxl::vector)
first | begin of the range to shuffle |
last | end of the range to shuffle |
M | number of bytes for internal use |
Definition at line 367 of file random_shuffle.h.
References stxxl::random_shuffle().
void stxxl::sort | ( | ExtIterator | first, |
ExtIterator | last, | ||
StrictWeakOrdering | cmp, | ||
unsigned_type | M | ||
) |
Sort records comparison-based, see stxxl::sort -- Sorting Comparison-Based.
stxxl::sort sorts the elements in [first, last) into ascending order, meaning that if i
and j
are any two valid iterators in [first, last) such that i
precedes j
, then *j
is not less than *i
. Note: as std::sort, stxxl::sort is not guaranteed to be stable. That is, suppose that *i
and *j
are equivalent: neither one is less than the other. It is not guaranteed that the relative order of these two elements will be preserved by stxxl::sort.
The order is defined by the cmp
parameter. The sorter's internal memory consumption is bounded by M bytes.
first | object of model of ext_random_access_iterator concept |
last | object of model of ext_random_access_iterator concept |
cmp | comparison object of StrictWeakOrdering Comparison Concept |
M | amount of memory for internal use (in bytes) |
Definition at line 673 of file sort.h.
References stxxl::block_manager::delete_block(), stxxl::is_sorted(), stxxl::block_manager::new_block(), stxxl::sort_local::sort_blocks(), stxxl::sort_memory_usage_factor(), stxxl::stl_in_memory_sort(), stxxl::sort_helper::verify_sentinel_strict_weak_ordering(), and stxxl::request_interface::wait().
Referenced by stxxl::cleanup(), stxxl::stream::basic_runs_creator< Input_, CompareType_, BlockSize_, AllocStr_ >::compute_result(), stxxl::sort_local::create_runs(), stxxl::sorter< ValueType, CompareType, BlockSize, AllocStrategy >::rewind(), stxxl::sorter< ValueType, CompareType, BlockSize, AllocStrategy >::sort(), stxxl::stream::basic_runs_creator< stream::use_push< ValueType >, cmp_type, BlockSize_, alloc_strategy_type >::sort_run(), stxxl::stream::runs_creator< use_push< ValueType_ >, CompareType_, BlockSize_, AllocStr_ >::sort_run(), stxxl::priority_queue_local::internal_priority_queue< value_type, std::vector< value_type >, comparator_type >::sort_to(), and stxxl::stl_in_memory_sort().
void stxxl::sort | ( | RandomAccessIterator | begin, |
RandomAccessIterator | end, | ||
CmpType | cmp, | ||
unsigned_type | MemSize, | ||
AllocStr | AS | ||
) |
Sorts range of any random access iterators externally.
begin | iterator pointing to the first element of the range |
end | iterator pointing to the last+1 element of the range |
cmp | comparison object |
MemSize | memory to use for sorting (in bytes) |
AS | allocation strategy |
The BlockSize
template parameter defines the block size to use (in bytes)
Definition at line 1604 of file sort_stream.h.
References stxxl::stream::materialize(), stxxl::stream::streamify(), and stxxl::STXXL_UNUSED().
void stxxl::stable_ksort | ( | ExtIterator_ | first, |
ExtIterator_ | last, | ||
unsigned_type | M | ||
) |
Sort records with integer keys.
first | object of model of ext_random_access_iterator concept |
last | object of model of ext_random_access_iterator concept |
M | amount of memory for internal use (in bytes) |
Definition at line 224 of file stable_ksort.h.
References stxxl::classify(), stxxl::classify_block(), stxxl::config::disks_number(), stxxl::stable_ksort_local::distribute(), stxxl::div_ceil(), stxxl::exclusive_prefix_sum(), stxxl::ilog2_ceil(), stxxl::ilog2_floor(), stxxl::l1sort(), STXXL_ERRMSG, STXXL_L2_SIZE, stxxl::STXXL_MAX(), STXXL_MSG, stxxl::STXXL_UNUSED(), STXXL_VERBOSE, STXXL_VERBOSE_STABLE_KSORT, stxxl::timestamp(), and stxxl::request_interface::wait().