32 #ifndef _GLIBCXX_PARALLEL_UNIQUE_COPY_H
33 #define _GLIBCXX_PARALLEL_UNIQUE_COPY_H 1
46 template<
typename _IIter,
47 class _OutputIterator,
48 class _BinaryPredicate>
51 _OutputIterator __result,
52 _BinaryPredicate __binary_pred)
57 typedef typename _TraitsType::value_type _ValueType;
58 typedef typename _TraitsType::difference_type _DifferenceType;
60 _DifferenceType __size = __last - __first;
66 _DifferenceType *__counter;
67 _DifferenceType *__borders;
71 # pragma omp parallel num_threads(__num_threads)
75 __num_threads = omp_get_num_threads();
76 __borders =
new _DifferenceType[__num_threads + 2];
78 __counter =
new _DifferenceType[__num_threads + 1];
83 _DifferenceType __begin, __end;
87 _DifferenceType __i = 0;
88 _OutputIterator __out = __result;
92 __begin = __borders[0] + 1;
93 __end = __borders[__iam + 1];
98 for (_IIter __iter = __first + __begin; __iter < __first + __end;
101 if (!__binary_pred(*__iter, *(__iter - 1)))
110 __begin = __borders[__iam];
111 __end = __borders[__iam + 1];
113 for (_IIter __iter = __first + __begin; __iter < __first + __end;
116 if (!__binary_pred(*__iter, *(__iter - 1)))
120 __counter[__iam] = __i;
123 _DifferenceType __begin_output;
133 __begin_output += __counter[__t];
137 _OutputIterator __iter_out = __result + __begin_output;
139 __begin = __borders[__num_threads];
142 for (_IIter __iter = __first + __begin; __iter < __first + __end;
145 if (__iter == __first
146 || !__binary_pred(*__iter, *(__iter - 1)))
149 *__iter_out++ = *__iter;
153 __counter[__num_threads] = __i;
158 __begin_output += __counter[__t];
160 _OutputIterator __iter_out = __result + __begin_output;
161 for (_IIter __iter = __first + __begin; __iter < __first + __end;
164 if (!__binary_pred(*__iter, *(__iter - 1)))
165 *__iter_out++ = *__iter;
170 _DifferenceType __end_output = 0;
171 for (
_ThreadIndex __t = 0; __t < __num_threads + 1; __t++)
172 __end_output += __counter[__t];
176 return __result + __end_output;
184 template<
typename _IIter,
class _OutputIterator>
185 inline _OutputIterator
187 _OutputIterator __result)
#define _GLIBCXX_CALL(__n)
Macro to produce log message when entering a function.
Functions to find elements of a certain global __rank in multiple sorted sequences....
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
GNU parallel code for public use.
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
_OutputIterator __parallel_unique_copy(_IIter __first, _IIter __last, _OutputIterator __result, _BinaryPredicate __binary_pred)
Parallel std::unique_copy(), w/__o explicit equality predicate.
_OutputIterator __equally_split(_DifferenceType __n, _ThreadIndex __num_threads, _OutputIterator __s)
function to split a sequence into parts of almost equal size.
Traits class for iterators.
One of the comparison functors.