Blaze 3.9
Loading...
Searching...
No Matches
blaze::ReduceTrait< T, OP, RF > Struct Template Reference

Base template for the ReduceTrait class. More...

#include <ReduceTrait.h>

Detailed Description

template<typename T, typename OP, ReductionFlag... RF>
struct blaze::ReduceTrait< T, OP, RF >

Base template for the ReduceTrait class.

General

The ReduceTrait class template offers the possibility to select the resulting data type of a generic reduction operation on the given type T. ReduceTrait defines the nested type Type, which represents the resulting data type of the reduction operation. In case no result type can be determined for the type T, there is no nested type Type. Note that const and volatile qualifiers and reference modifiers are generally ignored.


Creating custom specializations

ReduceTrait is guaranteed to work for all vector and matrix types of the Blaze library (including views and adaptors) and all data types that work in combination with the provided reduction operation OP. In order to add support for user-defined data types or in order to adapt to special cases it is possible to specialize the ReduceTrait template. The following examples shows the according specialization for total and partial reduction operations with a dynamic matrix, respectively:

template< typename T, bool SO, typename OP >
struct ReduceTrait< DynamicMatrix<T,SO>, OP >
{
using Type = T;
};
Efficient implementation of a dynamic matrix.
Definition DynamicMatrix.h:242
Base template for the ReduceTrait class.
Definition ReduceTrait.h:130
template< typename T, bool SO, typename OP >
struct ReduceTrait< DynamicMatrix<T,SO>, OP, columnwise >
{
};
template< typename T, bool SO, typename OP >
struct ReduceTrait< DynamicMatrix<T,SO>, OP, rowwise >
{
};
constexpr ReductionFlag columnwise
Reduction flag for column-wise reduction operations.
Definition ReductionFlag.h:97
constexpr ReductionFlag rowwise
Reduction flag for row-wise reduction operations.
Definition ReductionFlag.h:77
Efficient implementation of an arbitrary sized vector.
Definition DynamicVector.h:223

The documentation for this struct was generated from the following file: