summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/parallel/numeric
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 22:04:56 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 22:04:56 +0000
commitfdecf98971de2cd51ad53b29775f5d531ac59008 (patch)
tree8ceda119aad15db27f6c78695c31004f6be6a6dd /libstdc++-v3/include/parallel/numeric
parent8c2c51e82e7f9bab7ba3eb60b1dc5a7bfbb12673 (diff)
downloadppe42-gcc-fdecf98971de2cd51ad53b29775f5d531ac59008.tar.gz
ppe42-gcc-fdecf98971de2cd51ad53b29775f5d531ac59008.zip
2009-12-11 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/42352 * include/bits/list.tcc (sort): Use _GLIBCXX_MOVE for list::splice and list::merge calls. * testsuite/23_containers/list/operations/42352.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/parallel/numeric')
-rw-r--r--libstdc++-v3/include/parallel/numeric138
1 files changed, 72 insertions, 66 deletions
diff --git a/libstdc++-v3/include/parallel/numeric b/libstdc++-v3/include/parallel/numeric
index 0fc6ddcf2fc..eff597ea70a 100644
--- a/libstdc++-v3/include/parallel/numeric
+++ b/libstdc++-v3/include/parallel/numeric
@@ -80,8 +80,7 @@ namespace __parallel
__gnu_parallel::sequential_tag()); }
// Parallel algorithm for random access iterators.
- template<typename __RAIter, typename _Tp,
- typename _BinaryOperation>
+ template<typename __RAIter, typename _Tp, typename _BinaryOperation>
_Tp
__accumulate_switch(__RAIter __begin, __RAIter __end,
_Tp __init, _BinaryOperation __binary_op,
@@ -99,12 +98,12 @@ namespace __parallel
__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);
+ __gnu_parallel::_Nothing(),
+ __my_selector,
+ __gnu_parallel::
+ __accumulate_binop_reduct
+ <_BinaryOperation>(__binary_op),
+ __res, __res, -1);
return __res;
}
else
@@ -123,8 +122,8 @@ namespace __parallel
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>
@@ -136,8 +135,8 @@ 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>
@@ -149,7 +148,7 @@ namespace __parallel
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>
@@ -160,7 +159,7 @@ namespace __parallel
typedef iterator_traits<_IIter> _IteratorTraits;
typedef typename _IteratorTraits::iterator_category _IteratorCategory;
return __accumulate_switch(__begin, __end, __init, __binary_op,
- _IteratorCategory());
+ _IteratorCategory());
}
@@ -188,14 +187,14 @@ namespace __parallel
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().
@@ -224,13 +223,12 @@ namespace __parallel
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)
- { return inner_product(__first1, __last1, __first2, __init,
- __binary_op1, __binary_op2,
- __gnu_parallel::sequential_tag()); }
+ _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()); }
template<typename _IIter1, typename _IIter2, typename _Tp,
typename _BinaryFunction1, typename _BinaryFunction2>
@@ -246,10 +244,10 @@ 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,
@@ -265,9 +263,10 @@ 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>
@@ -319,7 +318,7 @@ namespace __parallel
// 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)
@@ -331,8 +330,8 @@ namespace __parallel
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.
@@ -340,14 +339,15 @@ namespace __parallel
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);
+ __result, __bin_op);
else
return partial_sum(__begin, __end, __result, __bin_op,
__gnu_parallel::sequential_tag());
@@ -376,7 +376,7 @@ namespace __parallel
typedef typename _OTraitsType::iterator_category _OIterCategory;
return __partial_sum_switch(__begin, __end, __result, __binary_op,
- _IIteratorCategory(), _OIterCategory());
+ _IIteratorCategory(), _OIterCategory());
}
// Sequential fallback.
@@ -393,17 +393,18 @@ namespace __parallel
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); }
+ { 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>
inline _OutputIterator
- __adjacent_difference_switch(
- _IIter __begin, _IIter __end, _OutputIterator __result,
- _BinaryOperation __bin_op, _IteratorTag1, _IteratorTag2)
+ __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()); }
@@ -411,12 +412,14 @@ namespace __parallel
template<typename _IIter, typename _OutputIterator,
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)
@@ -451,9 +454,9 @@ namespace __parallel
{
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>
@@ -464,7 +467,7 @@ namespace __parallel
typedef iterator_traits<_IIter> _TraitsType;
typedef typename _TraitsType::value_type _ValueType;
return adjacent_difference(__begin, __end, __result,
- std::minus<_ValueType>());
+ std::minus<_ValueType>());
}
template<typename _IIter, typename _OutputIterator,
@@ -480,16 +483,18 @@ 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> _ITraitsType;
typedef typename _ITraitsType::iterator_category _IIteratorCategory;
@@ -497,9 +502,10 @@ 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