Skip to content

Array functions

absmaxof function

template <typename E1, typename T = value_type_of<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.

Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T absmaxof(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::absmax());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L235

absminof function

template <typename E1, typename T = value_type_of<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.

Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T absminof(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::absmin());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L223

dotproduct function

template <typename E1, typename E2,
          typename T =
              value_type_of<decltype(std::declval<E1>() *
                                     std::declval<E2>())>,
          KFR_ENABLE_IF(is_input_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} \]
Source code
template <typename E1, typename E2,
          typename T = value_type_of<decltype(std::declval<E1>() * std::declval<E2>())>,
          KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
KFR_FUNCTION T dotproduct(E1&& x, E2&& y)
{
    auto m    = std::forward<E1>(x) * std::forward<E2>(y);
    using E12 = decltype(m);
    static_assert(!is_infinite<E12>, "e1 must be a sized expression (use slice())");
    return reduce(std::move(m), fn::add());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L252

maxof function

template <typename E1, typename T = value_type_of<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.

Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T maxof(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::max());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L211

mean function

template <typename E1, typename T = value_type_of<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}) \]
Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T mean(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::add(), fn_generic::pass_through(), fn::final_mean());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L187

minof function

template <typename E1, typename T = value_type_of<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.

Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T minof(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::min());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L199

product function

template <typename E1, typename T = value_type_of<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} \]
Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T product(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::mul());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L299

rms function

template <typename E1, typename T = value_type_of<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)} \]
Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T rms(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::add(), fn::sqr(), fn::final_rootmean());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L269

sum function

template <typename E1, typename T = value_type_of<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} \]
Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T sum(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::add());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L172

sumsqr function

template <typename E1, typename T = value_type_of<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 \]
Source code
template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION T sumsqr(const E1& x)
{
    static_assert(!is_infinite<E1>, "e1 must be a sized expression (use slice())");
    return reduce(x, fn::add(), fn::sqr());
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/reduce.hpp#L284


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