Skip to content

Reducing functions


absmaxof function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T absmaxof(const E1 &x)

Returns the greatest in magnitude of all the elements in x.

x must have its size and type specified.


absminof function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T absminof(const E1 &x)

Returns the smallest in magnitude of all the elements in x.

x must have its size and type specified.


dotproduct function

template <
    typename E1, typename E2,
    typename T = expression_value_type<
        decltype(std::declval<E1>() * std::declval<E2>())>,
    KFR_ACCEPT_EXPRESSIONS(E1, E2)>
T dotproduct(E1 &&x, E2 &&y)

Returns the dot product of two vectors.

x and y must have their sizes and types specified.

\[ x_0y_0 + x_1y_1 + \ldots + x_{N-1}y_{N-1} \]

histogram function

template <typename E, typename TCount = uint32_t>
histogram_data<0, TCount> histogram(E &&expr, size_t bins)

Returns histogram of the expression data. Number of bins defined at runtime


template <size_t Bins, typename E,
          typename TCount = uint32_t>
histogram_data<Bins, TCount> histogram(E &&expr)

Returns histogram of the expression data. Number of bins defined at compile time


histogram_expression function

template <typename E, typename TCount = uint32_t>
expression_histogram<0, E, TCount>
histogram_expression(E &&expr, size_t bins)

Returns expression that computes histogram as data flows through it. Number of bins defined at runtime


template <size_t Bins, typename E,
          typename TCount = uint32_t>
expression_histogram<Bins, E, TCount>
histogram_expression(E &&expr)

Returns expression that computes histogram as data flows through it. Number of bins defined at compile time


maxof function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T maxof(const E1 &x)

Returns the greatest of all the elements in x.

x must have its size and type specified.


mean function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T mean(const E1 &x)

Returns the arithmetic mean of all the elements in x.

x must have its size and type specified.

\[ \frac{1}{N}(x_0 + x_1 + \ldots + x_{N-1}) \]

minof function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T minof(const E1 &x)

Returns the smallest of all the elements in x.

x must have its size and type specified.


product function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T product(const E1 &x)

Returns the product of all the elements in x.

x must have its size and type specified.

\[ x_0 \cdot x_1 \cdot \ldots \cdot x_{N-1} \]

rms function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T rms(const E1 &x)

Returns the root mean square of all the elements in x.

x must have its size and type specified.

\[ \sqrt{\frac{1}{N}( x_0^2 + x_1^2 + \ldots + x_{N-1}^2)} \]

sum function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T sum(const E1 &x)

Returns the sum of all the elements in x.

x must have its size and type specified.

\[ x_0 + x_1 + \ldots + x_{N-1} \]

sumsqr function

template <typename E1,
          typename T = expression_value_type<E1>,
          KFR_ENABLE_IF(is_input_expression<E1>)>
T sumsqr(const E1 &x)

Returns the sum of squares of all the elements in x.

x must have its size and type specified.

\[ x_0^2 + x_1^2 + \ldots + x_{N-1}^2 \]

Auto-generated from sources, Revision 5191a48df06ea47104ca67db19fa82058d09c20a, https://github.com/kfrlib/kfr/blob/5191a48df06ea47104ca67db19fa82058d09c20a/include/kfr/