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#L65

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#L124

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#L116

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#L81

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#L89

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#L132

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#L73


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