Commit d97cea88 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added default reduction functional (TNL::Plus) to reduce

parent 4743a565
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -118,14 +118,14 @@ Result reduce( const Index begin,
template< typename Device,
          typename Index,
          typename Fetch,
          typename Reduction >
          typename Reduction = TNL::Plus >
auto reduce( const Index begin,
             const Index end,
             Fetch&& fetch,
             Reduction&& reduction )
             Reduction&& reduction = TNL::Plus{} )
{
   using Result = std::decay_t< decltype( fetch( 0 ) ) >;
   return detail::Reduction< Device >::reduce( begin,
   return reduce< Device >( begin,
                            end,
                            std::forward< Fetch >( fetch ),
                            std::forward< Reduction >( reduction ),
@@ -153,7 +153,7 @@ auto reduce( const Index begin,
 * \param reduction is a lambda function defining the reduction operation and managing the elements positions.
 * \param zero is the idempotent element for the reduction operation, i.e. element which
 *             does not change the result of the reduction.
 * \return result of the reduction in a form of std::pair< Index, Result> structure. `pair.first'
 * \return result of the reduction in a form of std::pair< Index, Result> structure. `pair.first`
 *         is the element position and `pair.second` is the reduction result.
 *
 * The `fetch` lambda function takes one argument which is index of the element to be fetched:
@@ -218,7 +218,7 @@ reduceWithArgument( const Index begin,
 * \param reduction is a lambda function defining the reduction operation and managing the elements positions.
 * \param zero is the idempotent element for the reduction operation, i.e. element which
 *             does not change the result of the reduction.
 * \return result of the reduction in a form of std::pair< Index, Result> structure. `pair.first'
 * \return result of the reduction in a form of std::pair< Index, Result> structure. `pair.first`
 *         is the element position and `pair.second` is the reduction result.
 *
 * The `fetch` lambda function takes one argument which is index of the element to be fetched:
@@ -252,7 +252,7 @@ reduceWithArgument( const Index begin,
                    Reduction&& reduction )
{
   using Result = std::decay_t< decltype( fetch( 0 ) ) >;
   return detail::Reduction< Device >::reduceWithArgument( begin,
   return reduceWithArgument< Device >( begin,
                                        end,
                                        std::forward< Fetch >( fetch ),
                                        std::forward< Reduction >( reduction ),