Namespaces | |
namespace | ksort_local |
namespace | sort_local |
namespace | stable_ksort_local |
Functions | |
template<typename ExtIterator_ , typename KeyExtractor_ > | |
void | ksort (ExtIterator_ first_, ExtIterator_ last_, KeyExtractor_ keyobj, unsigned_type M__) |
Sort records with integer keys. | |
template<typename ExtIterator_ > | |
void | ksort (ExtIterator_ first_, ExtIterator_ last_, unsigned_type M__) |
Sort records with integer keys. | |
template<typename ExtIterator_ , typename RandomNumberGenerator_ , unsigned BlockSize_, unsigned PageSize_, typename AllocStrategy_ > | |
void | random_shuffle (ExtIterator_ first, ExtIterator_ last, RandomNumberGenerator_ &rand, unsigned_type M, AllocStrategy_ AS=STXXL_DEFAULT_ALLOC_STRATEGY()) |
External equivalent of std::random_shuffle. | |
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_, typename RandomNumberGenerator_ > | |
void | 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). | |
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_> | |
void | 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). | |
template<typename _ExtIterator , typename _UnaryFunction > | |
_UnaryFunction | for_each (_ExtIterator _begin, _ExtIterator _end, _UnaryFunction _functor, int_type nbuffers) |
External equivalent of std::for_each. | |
template<typename _ExtIterator , typename _UnaryFunction > | |
_UnaryFunction | for_each_m (_ExtIterator _begin, _ExtIterator _end, _UnaryFunction _functor, int_type nbuffers) |
External equivalent of std::for_each (mutating). | |
template<typename _ExtIterator , typename _Generator > | |
void | generate (_ExtIterator _begin, _ExtIterator _end, _Generator _generator, int_type nbuffers) |
External equivalent of std::generate. | |
template<typename _ExtIterator , typename _EqualityComparable > | |
_ExtIterator | find (_ExtIterator _begin, _ExtIterator _end, const _EqualityComparable &_value, int_type nbuffers) |
External equivalent of std::find. | |
template<typename ExtIterator_ , typename StrictWeakOrdering_ > | |
void | sort (ExtIterator_ first, ExtIterator_ last, StrictWeakOrdering_ cmp, unsigned_type M) |
Sort records comparison-based. | |
template<typename ExtIterator_ > | |
void | stable_ksort (ExtIterator_ first, ExtIterator_ last, unsigned_type M) |
Sort records with integer keys. | |
template<unsigned BlockSize, class RandomAccessIterator , class CmpType , class AllocStr > | |
void | sort (RandomAccessIterator begin, RandomAccessIterator end, CmpType cmp, unsigned_type MemSize, AllocStr AS) |
Sorts range of any random access iterators externally. |
Algorithms with STL-compatible interface
Model of Key extractor concept must:
Example: extractor class GetWeight, that extracts weight from an Edge
struct Edge { unsigned src,dest,weight; Edge(unsigned s,unsigned d,unsigned w):src(s),dest(d),weight(w){} }; struct GetWeight { typedef unsigned key_type; key_type operator() (const Edge & e) const { return e.weight; } Edge min_value() const { return Edge(0,0,(std::numeric_limits<key_type>::min)()); }; Edge max_value() const { return Edge(0,0,(std::numeric_limits<key_type>::max)()); }; };
Model of Comparison concept must:
Example: comparator class my_less_int
struct my_less_int { bool operator() (int a, int b) const { return a < b; } int min_value() const { return std::numeric_limits<int>::min(); }; int max_value() const { return std::numeric_limits<int>::max(); }; };
Example: comparator class my_less, could be instantiated as e.g. my_less<int> , my_less<unsigned long> , ...
template <typename Tp> struct my_less { typedef Tp value_type; bool operator() (const value_type & a, const value_type & b) const { return a < b; } value_type min_value() const { return std::numeric_limits<value_type>::min(); }; value_type max_value() const { return std::numeric_limits<value_type>::max(); }; };
_ExtIterator find | ( | _ExtIterator | _begin, | |
_ExtIterator | _end, | |||
const _EqualityComparable & | _value, | |||
int_type | nbuffers | |||
) |
External equivalent of std::find.
<stxxl>
buffered streams (computation and I/O overlapped) _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
_UnaryFunction for_each | ( | _ExtIterator | _begin, | |
_ExtIterator | _end, | |||
_UnaryFunction | _functor, | |||
int_type | nbuffers | |||
) |
External equivalent of std::for_each.
<stxxl>
buffered streams (computation and I/O overlapped) _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 range_UnaryFunction for_each_m | ( | _ExtIterator | _begin, | |
_ExtIterator | _end, | |||
_UnaryFunction | _functor, | |||
int_type | nbuffers | |||
) |
External equivalent of std::for_each (mutating).
<stxxl>
buffered streams (computation and I/O overlapped) _begin | object of model of ext_random_access_iterator concept | |
_end | object of model of ext_random_access_iterator concept | |
_functor | ||
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 rangevoid generate | ( | _ExtIterator | _begin, | |
_ExtIterator | _end, | |||
_Generator | _generator, | |||
int_type | nbuffers | |||
) |
External equivalent of std::generate.
<stxxl>
buffered streams (computation and I/O overlapped) _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 ) |
void 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 buffers for internal use |
Record's type must:
References ksort().
void ksort | ( | ExtIterator_ | first_, | |
ExtIterator_ | last_, | |||
KeyExtractor_ | keyobj, | |||
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 | |
keyobj | key extractor object | |
M__ | amount of memory for internal use (in bytes) |
References block_manager::delete_block(), block_manager::new_block(), and wait_all().
Referenced by ksort().
void 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 |
References random_shuffle().
void 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 | |||
) | [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 |
References random_shuffle().
void 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 |
References stream::streamify().
Referenced by random_shuffle().
void 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)
References stream::materialize(), and stream::streamify().
void sort | ( | ExtIterator_ | first, | |
ExtIterator_ | last, | |||
StrictWeakOrdering_ | cmp, | |||
unsigned_type | M | |||
) |
Sort records comparison-based.
first | object of model of ext_random_access_iterator concept | |
last | object of model of ext_random_access_iterator concept | |
cmp | comparison object | |
M | amount of memory for internal use (in bytes) |
References block_manager::delete_block(), and block_manager::new_block().
Referenced by priority_queue_local::internal_priority_queue< value_type, std::vector< value_type >, comparator_type >::sort_to().
void 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) |
References config::disks_number().