summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/parallel/numeric
diff options
context:
space:
mode:
authorsingler <singler@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-17 08:42:39 +0000
committersingler <singler@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-17 08:42:39 +0000
commit84ec5566784efbac633966ca76a31eca3160dcc0 (patch)
tree11ed989c17b3740ffef24792c7397b0fbce1f891 /libstdc++-v3/include/parallel/numeric
parent9dbb96fec5e08762f97dda771522283f1fe9710f (diff)
downloadppe42-gcc-84ec5566784efbac633966ca76a31eca3160dcc0.tar.gz
ppe42-gcc-84ec5566784efbac633966ca76a31eca3160dcc0.zip
2009-09-17 Johannes Singler <singler@ira.uka.de>
* include/parallel/algobase.h: Replace tabs by spaces; correct line breaks. * include/parallel/algorithmfwd.h: Likewise. * include/parallel/balanced_quicksort.h: Likewise. * include/parallel/base.h: Likewise. * include/parallel/checkers.h: Likewise. * include/parallel/compatibility.h: Likewise. * include/parallel/equally_split.h: Likewise. * include/parallel/find.h: Likewise. * include/parallel/for_each.h: Likewise. * include/parallel/for_each_selectors.h: Likewise. * include/parallel/iterator.h: Likewise. * include/parallel/list_partition.h: Likewise. * include/parallel/losertree.h: Likewise. * include/parallel/merge.h: Likewise. * include/parallel/multiseq_selection.h: Likewise. * include/parallel/multiway_merge.h: Likewise. * include/parallel/multiway_mergesort.h: Likewise. * include/parallel/numeric: Likewise. * include/parallel/numericfwd.h: Likewise. * include/parallel/omp_loop.h: Likewise. * include/parallel/omp_loop_static.h: Likewise. * include/parallel/par_loop.h: Likewise. * include/parallel/partial_sum.h: Likewise. * include/parallel/partition.h: Likewise. * include/parallel/queue.h: Likewise. * include/parallel/quicksort.h: Likewise. * include/parallel/random_number.h: Likewise. * include/parallel/random_shuffle.h: Likewise. * include/parallel/search.h: Likewise. * include/parallel/set_operations.h: Likewise. * include/parallel/settings.h: Likewise. * include/parallel/sort.h: Likewise. * include/parallel/types.h: Likewise. * include/parallel/unique_copy.h: Likewise. * include/parallel/workstealing.h: Likewise. * include/parallel/algo.h: Likewise; shorten _ForwardIterator to _FIterator. * include/parallel/find_selectors.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151791 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/parallel/numeric')
-rw-r--r--libstdc++-v3/include/parallel/numeric365
1 files changed, 186 insertions, 179 deletions
diff --git a/libstdc++-v3/include/parallel/numeric b/libstdc++-v3/include/parallel/numeric
index e355097edd6..5d03e679c27 100644
--- a/libstdc++-v3/include/parallel/numeric
+++ b/libstdc++-v3/include/parallel/numeric
@@ -54,76 +54,77 @@ namespace __parallel
template<typename _IIter, typename _Tp>
inline _Tp
accumulate(_IIter __begin, _IIter __end, _Tp __init,
- __gnu_parallel::sequential_tag)
+ __gnu_parallel::sequential_tag)
{ return _GLIBCXX_STD_P::accumulate(__begin, __end, __init); }
template<typename _IIter, typename _Tp, typename _BinaryOperation>
inline _Tp
accumulate(_IIter __begin, _IIter __end, _Tp __init,
- _BinaryOperation __binary_op, __gnu_parallel::sequential_tag)
+ _BinaryOperation __binary_op, __gnu_parallel::sequential_tag)
{ return _GLIBCXX_STD_P::accumulate(__begin, __end, __init, __binary_op); }
// Sequential fallback for input iterator case.
template<typename _IIter, typename _Tp, typename _IteratorTag>
inline _Tp
__accumulate_switch(_IIter __begin, _IIter __end,
- _Tp __init, _IteratorTag)
- { return accumulate(__begin, __end, __init, __gnu_parallel::sequential_tag()); }
+ _Tp __init, _IteratorTag)
+ { return accumulate(__begin, __end, __init,
+__gnu_parallel::sequential_tag()); }
template<typename _IIter, typename _Tp, typename _BinaryOperation,
- typename _IteratorTag>
+ typename _IteratorTag>
inline _Tp
__accumulate_switch(_IIter __begin, _IIter __end, _Tp __init,
- _BinaryOperation __binary_op, _IteratorTag)
+ _BinaryOperation __binary_op, _IteratorTag)
{ return accumulate(__begin, __end, __init, __binary_op,
- __gnu_parallel::sequential_tag()); }
+ __gnu_parallel::sequential_tag()); }
// Parallel algorithm for random access iterators.
template<typename __RAIter, typename _Tp,
- typename _BinaryOperation>
+ typename _BinaryOperation>
_Tp
__accumulate_switch(__RAIter __begin, __RAIter __end,
- _Tp __init, _BinaryOperation __binary_op,
- random_access_iterator_tag,
- __gnu_parallel::_Parallelism __parallelism_tag
- = __gnu_parallel::parallel_unbalanced)
+ _Tp __init, _BinaryOperation __binary_op,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism __parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
{
if (_GLIBCXX_PARALLEL_CONDITION(
- static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
- >= __gnu_parallel::_Settings::get().accumulate_minimal_n
- && __gnu_parallel::__is_parallel(__parallelism_tag)))
- {
- _Tp __res = __init;
- __gnu_parallel::__accumulate_selector<__RAIter>
- __my_selector;
- __gnu_parallel::
- for_each_template_random_access_ed(__begin, __end,
- __gnu_parallel::_Nothing(),
- __my_selector,
- __gnu_parallel::
- __accumulate_binop_reduct
- <_BinaryOperation>(__binary_op),
- __res, __res, -1);
- return __res;
- }
+ static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+ >= __gnu_parallel::_Settings::get().accumulate_minimal_n
+ && __gnu_parallel::__is_parallel(__parallelism_tag)))
+ {
+ _Tp __res = __init;
+ __gnu_parallel::__accumulate_selector<__RAIter>
+ __my_selector;
+ __gnu_parallel::
+ for_each_template_random_access_ed(__begin, __end,
+ __gnu_parallel::_Nothing(),
+ __my_selector,
+ __gnu_parallel::
+ __accumulate_binop_reduct
+ <_BinaryOperation>(__binary_op),
+ __res, __res, -1);
+ return __res;
+ }
else
- return accumulate(__begin, __end, __init, __binary_op,
- __gnu_parallel::sequential_tag());
+ return accumulate(__begin, __end, __init, __binary_op,
+ __gnu_parallel::sequential_tag());
}
// Public interface.
template<typename _IIter, typename _Tp>
inline _Tp
accumulate(_IIter __begin, _IIter __end, _Tp __init,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef std::iterator_traits<_IIter> _IteratorTraits;
typedef typename _IteratorTraits::value_type _ValueType;
typedef typename _IteratorTraits::iterator_category _IteratorCategory;
return __accumulate_switch(__begin, __end, __init,
- __gnu_parallel::_Plus<_Tp, _ValueType>(),
- _IteratorCategory(), __parallelism_tag);
+ __gnu_parallel::_Plus<_Tp, _ValueType>(),
+ _IteratorCategory(), __parallelism_tag);
}
template<typename _IIter, typename _Tp>
@@ -135,31 +136,31 @@ namespace __parallel
typedef typename _IteratorTraits::iterator_category _IteratorCategory;
return __accumulate_switch(__begin, __end, __init,
- __gnu_parallel::_Plus<_Tp, _ValueType>(),
- _IteratorCategory());
+ __gnu_parallel::_Plus<_Tp, _ValueType>(),
+ _IteratorCategory());
}
template<typename _IIter, typename _Tp, typename _BinaryOperation>
inline _Tp
accumulate(_IIter __begin, _IIter __end, _Tp __init,
- _BinaryOperation __binary_op,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ _BinaryOperation __binary_op,
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef iterator_traits<_IIter> _IteratorTraits;
typedef typename _IteratorTraits::iterator_category _IteratorCategory;
return __accumulate_switch(__begin, __end, __init, __binary_op,
- _IteratorCategory(), __parallelism_tag);
+ _IteratorCategory(), __parallelism_tag);
}
template<typename _IIter, typename _Tp, typename _BinaryOperation>
inline _Tp
accumulate(_IIter __begin, _IIter __end, _Tp __init,
- _BinaryOperation __binary_op)
+ _BinaryOperation __binary_op)
{
typedef iterator_traits<_IIter> _IteratorTraits;
typedef typename _IteratorTraits::iterator_category _IteratorCategory;
return __accumulate_switch(__begin, __end, __init, __binary_op,
- _IteratorCategory());
+ _IteratorCategory());
}
@@ -167,75 +168,76 @@ namespace __parallel
template<typename _IIter1, typename _IIter2, typename _Tp>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init,
- __gnu_parallel::sequential_tag)
- { return _GLIBCXX_STD_P::inner_product(__first1, __last1, __first2, __init); }
+ _IIter2 __first2, _Tp __init,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::inner_product(
+ __first1, __last1, __first2, __init); }
template<typename _IIter1, typename _IIter2, typename _Tp,
- typename BinaryFunction1, typename BinaryFunction2>
+ typename BinaryFunction1, typename BinaryFunction2>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
- BinaryFunction2 __binary_op2, __gnu_parallel::sequential_tag)
- { return _GLIBCXX_STD_P::inner_product(__first1, __last1, __first2, __init,
- __binary_op1, __binary_op2); }
+ _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
+ BinaryFunction2 __binary_op2, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::inner_product(__first1, __last1, __first2, __init,
+ __binary_op1, __binary_op2); }
// Parallel algorithm for random access iterators.
template<typename _RAIter1, typename _RAIter2,
- typename _Tp, typename BinaryFunction1, typename BinaryFunction2>
+ typename _Tp, typename BinaryFunction1, typename BinaryFunction2>
_Tp
__inner_product_switch(_RAIter1 __first1,
- _RAIter1 __last1,
- _RAIter2 __first2, _Tp __init,
- BinaryFunction1 __binary_op1,
- BinaryFunction2 __binary_op2,
- random_access_iterator_tag,
- random_access_iterator_tag,
- __gnu_parallel::_Parallelism __parallelism_tag
- = __gnu_parallel::parallel_unbalanced)
+ _RAIter1 __last1,
+ _RAIter2 __first2, _Tp __init,
+ BinaryFunction1 __binary_op1,
+ BinaryFunction2 __binary_op2,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism __parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
{
if (_GLIBCXX_PARALLEL_CONDITION((__last1 - __first1)
- >= __gnu_parallel::_Settings::get().
- accumulate_minimal_n
- && __gnu_parallel::
- __is_parallel(__parallelism_tag)))
- {
- _Tp __res = __init;
- __gnu_parallel::
- __inner_product_selector<_RAIter1,
- _RAIter2, _Tp> __my_selector(__first1, __first2);
- __gnu_parallel::
- for_each_template_random_access_ed(__first1, __last1, __binary_op2,
- __my_selector, __binary_op1,
- __res, __res, -1);
- return __res;
- }
+ >= __gnu_parallel::_Settings::get().
+ accumulate_minimal_n
+ && __gnu_parallel::
+ __is_parallel(__parallelism_tag)))
+ {
+ _Tp __res = __init;
+ __gnu_parallel::
+ __inner_product_selector<_RAIter1,
+ _RAIter2, _Tp> __my_selector(__first1, __first2);
+ __gnu_parallel::
+ for_each_template_random_access_ed(__first1, __last1, __binary_op2,
+ __my_selector, __binary_op1,
+ __res, __res, -1);
+ return __res;
+ }
else
- return inner_product(__first1, __last1, __first2, __init,
- __gnu_parallel::sequential_tag());
+ return inner_product(__first1, __last1, __first2, __init,
+ __gnu_parallel::sequential_tag());
}
// No parallelism for input iterators.
template<typename _IIter1, typename _IIter2, typename _Tp,
- typename BinaryFunction1, typename BinaryFunction2,
- typename _IteratorTag1, typename _IteratorTag2>
+ typename BinaryFunction1, typename BinaryFunction2,
+ typename _IteratorTag1, typename _IteratorTag2>
inline _Tp
__inner_product_switch(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init,
- BinaryFunction1 __binary_op1,
- BinaryFunction2 __binary_op2,
- _IteratorTag1, _IteratorTag2)
+ _IIter2 __first2, _Tp __init,
+ BinaryFunction1 __binary_op1,
+ BinaryFunction2 __binary_op2,
+ _IteratorTag1, _IteratorTag2)
{ return inner_product(__first1, __last1, __first2, __init,
- __binary_op1, __binary_op2,
- __gnu_parallel::sequential_tag()); }
+ __binary_op1, __binary_op2,
+ __gnu_parallel::sequential_tag()); }
template<typename _IIter1, typename _IIter2, typename _Tp,
- typename BinaryFunction1, typename BinaryFunction2>
+ typename BinaryFunction1, typename BinaryFunction2>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
- BinaryFunction2 __binary_op2,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
+ BinaryFunction2 __binary_op2,
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef iterator_traits<_IIter1> _TraitsType1;
typedef typename _TraitsType1::iterator_category _IteratorCategory1;
@@ -243,17 +245,18 @@ namespace __parallel
typedef iterator_traits<_IIter2> _TraitsType2;
typedef typename _TraitsType2::iterator_category _IteratorCategory2;
- return __inner_product_switch(__first1, __last1, __first2, __init, __binary_op1,
- __binary_op2, _IteratorCategory1(),
- _IteratorCategory2(), __parallelism_tag);
+ return __inner_product_switch(
+ __first1, __last1, __first2, __init, __binary_op1,
+ __binary_op2, _IteratorCategory1(), _IteratorCategory2(),
+ __parallelism_tag);
}
template<typename _IIter1, typename _IIter2, typename _Tp,
- typename BinaryFunction1, typename BinaryFunction2>
+ typename BinaryFunction1, typename BinaryFunction2>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
- BinaryFunction2 __binary_op2)
+ _IIter2 __first2, _Tp __init, BinaryFunction1 __binary_op1,
+ BinaryFunction2 __binary_op2)
{
typedef iterator_traits<_IIter1> _TraitsType1;
typedef typename _TraitsType1::iterator_category _IteratorCategory1;
@@ -261,16 +264,16 @@ namespace __parallel
typedef iterator_traits<_IIter2> _TraitsType2;
typedef typename _TraitsType2::iterator_category _IteratorCategory2;
- return __inner_product_switch(__first1, __last1, __first2, __init, __binary_op1,
- __binary_op2, _IteratorCategory1(),
- _IteratorCategory2());
+ return __inner_product_switch(
+ __first1, __last1, __first2, __init, __binary_op1, __binary_op2,
+ _IteratorCategory1(), _IteratorCategory2());
}
template<typename _IIter1, typename _IIter2, typename _Tp>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ _IIter2 __first2, _Tp __init,
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef iterator_traits<_IIter1> traits_type1;
typedef typename traits_type1::value_type value_type1;
@@ -278,19 +281,19 @@ namespace __parallel
typedef typename traits_type2::value_type value_type2;
typedef typename
- __gnu_parallel::_Multiplies<value_type1, value_type2>::__result
+ __gnu_parallel::_Multiplies<value_type1, value_type2>::__result
_MultipliesResultType;
return inner_product(__first1, __last1, __first2, __init,
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
__gnu_parallel::
- _Multiplies<value_type1, value_type2>(),
+ _Multiplies<value_type1, value_type2>(),
__parallelism_tag);
}
template<typename _IIter1, typename _IIter2, typename _Tp>
inline _Tp
inner_product(_IIter1 __first1, _IIter1 __last1,
- _IIter2 __first2, _Tp __init)
+ _IIter2 __first2, _Tp __init)
{
typedef iterator_traits<_IIter1> traits_type1;
typedef typename traits_type1::value_type value_type1;
@@ -298,55 +301,55 @@ namespace __parallel
typedef typename traits_type2::value_type value_type2;
typedef typename
- __gnu_parallel::_Multiplies<value_type1, value_type2>::__result
+ __gnu_parallel::_Multiplies<value_type1, value_type2>::__result
_MultipliesResultType;
return inner_product(__first1, __last1, __first2, __init,
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
__gnu_parallel::
- _Multiplies<value_type1, value_type2>());
+ _Multiplies<value_type1, value_type2>());
}
// Sequential fallback.
template<typename _IIter, typename _OutputIterator>
inline _OutputIterator
partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
- __gnu_parallel::sequential_tag)
+ __gnu_parallel::sequential_tag)
{ return _GLIBCXX_STD_P::partial_sum(__begin, __end, __result); }
// Sequential fallback.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
inline _OutputIterator
partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
- _BinaryOperation __bin_op, __gnu_parallel::sequential_tag)
+ _BinaryOperation __bin_op, __gnu_parallel::sequential_tag)
{ return _GLIBCXX_STD_P::partial_sum(__begin, __end, __result, __bin_op); }
// Sequential fallback for input iterator case.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation, typename _IteratorTag1,
- typename _IteratorTag2>
+ typename _BinaryOperation, typename _IteratorTag1,
+ typename _IteratorTag2>
inline _OutputIterator
__partial_sum_switch(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __bin_op,
- _IteratorTag1, _IteratorTag2)
+ _OutputIterator __result, _BinaryOperation __bin_op,
+ _IteratorTag1, _IteratorTag2)
{ return _GLIBCXX_STD_P::partial_sum(__begin, __end, __result, __bin_op); }
// Parallel algorithm for random access iterators.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
_OutputIterator
__partial_sum_switch(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __bin_op,
- random_access_iterator_tag, random_access_iterator_tag)
+ _OutputIterator __result, _BinaryOperation __bin_op,
+ random_access_iterator_tag, random_access_iterator_tag)
{
if (_GLIBCXX_PARALLEL_CONDITION(
- static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
- >= __gnu_parallel::_Settings::get().partial_sum_minimal_n))
- return __gnu_parallel::__parallel_partial_sum(__begin, __end,
- __result, __bin_op);
+ static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+ >= __gnu_parallel::_Settings::get().partial_sum_minimal_n))
+ return __gnu_parallel::__parallel_partial_sum(__begin, __end,
+ __result, __bin_op);
else
- return partial_sum(__begin, __end, __result, __bin_op,
- __gnu_parallel::sequential_tag());
+ return partial_sum(__begin, __end, __result, __bin_op,
+ __gnu_parallel::sequential_tag());
}
// Public interface.
@@ -360,10 +363,10 @@ namespace __parallel
// Public interface
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
inline _OutputIterator
partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
- _BinaryOperation __binary_op)
+ _BinaryOperation __binary_op)
{
typedef iterator_traits<_IIter> traitsi_type;
typedef typename traitsi_type::iterator_category _IIteratorCategory;
@@ -372,100 +375,104 @@ namespace __parallel
typedef typename _OTraitsType::iterator_category _OIterCategory;
return __partial_sum_switch(__begin, __end, __result, __binary_op,
- _IIteratorCategory(), _OIterCategory());
+ _IIteratorCategory(), _OIterCategory());
}
// Sequential fallback.
template<typename _IIter, typename _OutputIterator>
inline _OutputIterator
- adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result, __gnu_parallel::sequential_tag)
+ adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result,
+ __gnu_parallel::sequential_tag)
{ return _GLIBCXX_STD_P::adjacent_difference(__begin, __end, __result); }
// Sequential fallback.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
inline _OutputIterator
adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __bin_op,
- __gnu_parallel::sequential_tag)
- { return _GLIBCXX_STD_P::adjacent_difference(__begin, __end, __result, __bin_op); }
+ _OutputIterator __result, _BinaryOperation __bin_op,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::adjacent_difference(
+ __begin, __end, __result, __bin_op); }
// Sequential fallback for input iterator case.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation, typename _IteratorTag1,
- typename _IteratorTag2>
+ typename _BinaryOperation, typename _IteratorTag1,
+ typename _IteratorTag2>
inline _OutputIterator
- __adjacent_difference_switch(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __bin_op,
- _IteratorTag1, _IteratorTag2)
- { return adjacent_difference(__begin, __end, __result, __bin_op,
- __gnu_parallel::sequential_tag()); }
+ __adjacent_difference_switch(
+ _IIter __begin, _IIter __end, _OutputIterator __result,
+ _BinaryOperation __bin_op, _IteratorTag1, _IteratorTag2)
+ { return adjacent_difference(__begin, __end, __result, __bin_op,
+ __gnu_parallel::sequential_tag()); }
// Parallel algorithm for random access iterators.
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
_OutputIterator
- __adjacent_difference_switch(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __bin_op,
- random_access_iterator_tag,
- random_access_iterator_tag,
- __gnu_parallel::_Parallelism __parallelism_tag
- = __gnu_parallel::parallel_balanced)
+ __adjacent_difference_switch(
+ _IIter __begin, _IIter __end, _OutputIterator __result,
+ _BinaryOperation __bin_op,
+ random_access_iterator_tag, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism __parallelism_tag
+ = __gnu_parallel::parallel_balanced)
{
if (_GLIBCXX_PARALLEL_CONDITION(
- static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
- >= __gnu_parallel::_Settings::get().adjacent_difference_minimal_n
- && __gnu_parallel::__is_parallel(__parallelism_tag)))
- {
- bool __dummy = true;
- typedef __gnu_parallel::_IteratorPair<_IIter, _OutputIterator,
- random_access_iterator_tag> _ItTrip;
- *__result = *__begin;
- _ItTrip begin_pair(__begin + 1, __result + 1),
- end_pair(__end, __result + (__end - __begin));
- __gnu_parallel::__adjacent_difference_selector<_ItTrip> __functionality;
- __gnu_parallel::
- for_each_template_random_access_ed(begin_pair, end_pair, __bin_op,
- __functionality,
- __gnu_parallel::_DummyReduct(),
- __dummy, __dummy, -1);
- return __functionality.finish_iterator;
- }
+ static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+ >= __gnu_parallel::_Settings::get().adjacent_difference_minimal_n
+ && __gnu_parallel::__is_parallel(__parallelism_tag)))
+ {
+ bool __dummy = true;
+ typedef __gnu_parallel::_IteratorPair<_IIter, _OutputIterator,
+ random_access_iterator_tag> _ItTrip;
+ *__result = *__begin;
+ _ItTrip begin_pair(__begin + 1, __result + 1),
+ end_pair(__end, __result + (__end - __begin));
+ __gnu_parallel::__adjacent_difference_selector<_ItTrip>
+ __functionality;
+ __gnu_parallel::
+ for_each_template_random_access_ed(begin_pair, end_pair, __bin_op,
+ __functionality,
+ __gnu_parallel::_DummyReduct(),
+ __dummy, __dummy, -1);
+ return __functionality.finish_iterator;
+ }
else
- return adjacent_difference(__begin, __end, __result, __bin_op,
- __gnu_parallel::sequential_tag());
+ return adjacent_difference(__begin, __end, __result, __bin_op,
+ __gnu_parallel::sequential_tag());
}
// Public interface.
template<typename _IIter, typename _OutputIterator>
inline _OutputIterator
adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ _OutputIterator __result,
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef iterator_traits<_IIter> _TraitsType;
typedef typename _TraitsType::value_type _ValueType;
- return adjacent_difference(__begin, __end, __result, std::minus<_ValueType>(),
- __parallelism_tag);
+ return adjacent_difference(
+ __begin, __end, __result, std::minus<_ValueType>(),
+ __parallelism_tag);
}
template<typename _IIter, typename _OutputIterator>
inline _OutputIterator
adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result)
+ _OutputIterator __result)
{
typedef iterator_traits<_IIter> _TraitsType;
typedef typename _TraitsType::value_type _ValueType;
- return adjacent_difference(__begin, __end, __result, std::minus<_ValueType>());
+ return adjacent_difference(__begin, __end, __result,
+ std::minus<_ValueType>());
}
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
inline _OutputIterator
adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __binary_op,
- __gnu_parallel::_Parallelism __parallelism_tag)
+ _OutputIterator __result, _BinaryOperation __binary_op,
+ __gnu_parallel::_Parallelism __parallelism_tag)
{
typedef iterator_traits<_IIter> traitsi_type;
typedef typename traitsi_type::iterator_category _IIteratorCategory;
@@ -473,16 +480,16 @@ namespace __parallel
typedef iterator_traits<_OutputIterator> _OTraitsType;
typedef typename _OTraitsType::iterator_category _OIterCategory;
- return __adjacent_difference_switch(__begin, __end, __result, __binary_op,
- _IIteratorCategory(),
- _OIterCategory(), __parallelism_tag);
+ return __adjacent_difference_switch(
+ __begin, __end, __result, __binary_op,
+ _IIteratorCategory(), _OIterCategory(), __parallelism_tag);
}
template<typename _IIter, typename _OutputIterator,
- typename _BinaryOperation>
+ typename _BinaryOperation>
inline _OutputIterator
adjacent_difference(_IIter __begin, _IIter __end,
- _OutputIterator __result, _BinaryOperation __binary_op)
+ _OutputIterator __result, _BinaryOperation __binary_op)
{
typedef iterator_traits<_IIter> traitsi_type;
typedef typename traitsi_type::iterator_category _IIteratorCategory;
@@ -490,9 +497,9 @@ namespace __parallel
typedef iterator_traits<_OutputIterator> _OTraitsType;
typedef typename _OTraitsType::iterator_category _OIterCategory;
- return __adjacent_difference_switch(__begin, __end, __result, __binary_op,
- _IIteratorCategory(),
- _OIterCategory());
+ return __adjacent_difference_switch(
+ __begin, __end, __result, __binary_op,
+ _IIteratorCategory(), _OIterCategory());
}
} // end namespace
} // end namespace
OpenPOWER on IntegriCloud