ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ParallelMerge.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*-------------------------- File ParallelMerge.h --------------------------*/
3/*--------------------------------------------------------------------------*/
58/*--------------------------------------------------------------------------*/
59/*----------------------------- DEFINITIONS --------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#ifndef __ADS_ParallelMerge
63 #define __ADS_ParallelMerge
64/* self-identification: #endif constant */
65
66/*--------------------------------------------------------------------------*/
67/*------------------------------ INCLUDES ----------------------------------*/
68/*--------------------------------------------------------------------------*/
69
70#include "ADS/Contract.h"
73
74#include <algorithm>
75#include <cstddef>
76#include <functional>
77#include <iterator>
78#include <utility>
79#include <vector>
80
81/*--------------------------------------------------------------------------*/
82/*--------------------------- NAMESPACE ------------------------------------*/
83/*--------------------------------------------------------------------------*/
84
85namespace ADS
86{
87
123template< std::random_access_iterator I , class C = std::less<> >
124[[nodiscard]] std::vector< std::size_t >
125multisequenceSplit( const std::vector< std::pair< I , I > > & R ,
126 std::size_t r ,
127 C less = C() );
128
158template< Executor E , std::random_access_iterator I ,
159 std::random_access_iterator O , class C = std::less<> >
160O multiwayMerge( E & ex , const std::vector< std::pair< I , I > > & R , O out ,
161 C less = C() );
162
163/*--------------------------------------------------------------------------*/
164
165} // end( namespace ADS )
166
167/*--------------------------------------------------------------------------*/
168/*-------------------------- IMPLEMENTATION --------------------------------*/
169/*--------------------------------------------------------------------------*/
170
171#include "ADS/parallel/impl/ParallelMerge.tpp"
172
173/*--------------------------------------------------------------------------*/
174
175#endif /* ParallelMerge.h included */
176
177/*--------------------------------------------------------------------------*/
178/*------------------------ End File ParallelMerge.h ------------------------*/
179/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls...
The engineered merge of sorted sequences, beyond the book [see LoserTree.h for the tree of losers of...
the executors, whose bulk( n , f ) runs on their threads and returns when they have returned,...
Definition Executor.h:168
std::vector< std::size_t > multisequenceSplit(const std::vector< std::pair< I, I > > &R, std::size_t r, C less=C())
the split of the sorted ranges at the rank of the stable merge, i.e., the number of items that each...
O multiwayMerge(E &ex, const std::vector< std::pair< I, I > > &R, O out, C less=C())
the items of the sorted ranges merged into out on the threads of ex, the range of lower index first ...
Definition ADT.h:96