Skip to content

SIMD shuffle Functions

hadd function

template <typename T, size_t N>
T hadd(const vec<T, N> &value)

Sum all elements of the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hadd(const vec<T, N>& value)
{
    return horizontal(value, fn::add());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L66

havg function

template <typename T, size_t N>
T havg(const vec<T, N> &value)

Calculate the Arithmetic mean of all elements in the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T havg(const vec<T, N>& value)
{
    return hadd(value) / N;
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L125

hdot function

template <typename T, size_t N>
T hdot(const vec<T, N> &x, const vec<T, N> &y)

Calculate the Dot-Product of two vectors

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hdot(const vec<T, N>& x, const vec<T, N>& y)
{
    return hadd(x * y);
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L117

hmax function

template <typename T, size_t N>
T hmax(const vec<T, N> &value)

Calculate the maximum of all elements in the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hmax(const vec<T, N>& value)
{
    return horizontal(value, fn::max());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L149

hmin function

template <typename T, size_t N>
T hmin(const vec<T, N> &value)

Calculate the minimum of all elements in the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hmin(const vec<T, N>& value)
{
    return horizontal(value, fn::min());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L141

hmul function

template <typename T, size_t N>
T hmul(const vec<T, N> &value)

Multiply all elements of the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hmul(const vec<T, N>& value)
{
    return horizontal(value, fn::mul());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L82

hproduct function

template <typename T, size_t N>
T hproduct(const vec<T, N> &value)

Multiply all elements of the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hproduct(const vec<T, N>& value)
{
    return horizontal(value, fn::mul());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L90

hrms function

template <typename T, size_t N>
T hrms(const vec<T, N> &value)

Calculate the RMS of all elements in the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hrms(const vec<T, N>& value)
{
    return builtin_sqrt(hadd(value * value) / N);
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L133

hsum function

template <typename T, size_t N>
T hsum(const vec<T, N> &value)

Sum all elements of the vector

Source code
template <typename T, size_t N>
KFR_INTRINSIC T hsum(const vec<T, N>& value)
{
    return horizontal(value, fn::add());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/horizontal.hpp#L74


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