MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
algorithm.hpp File Reference
#include <cstddef>
#include <type_traits>
#include <mtl/simd/batch.hpp>
#include <mtl/simd/scalable.hpp>

Classes

struct  mtl::simd::detail::block_accumulator< NA, NB, Quad >
 The 32-bit accumulator of a widening operand pair: the 16-bit pairs widen pairwise, the 8-bit pairs by four. More...
struct  mtl::simd::detail::block_accumulator< NA, NB, true >

Namespaces

namespace  mtl
namespace  mtl::simd
namespace  mtl::simd::detail
 Blocking parameters for T using the compiled SIMD width and the target hardware traits.

Functions

template<typename T>
T mtl::simd::reduce_dot (const T *a, const T *b, std::size_t n)
 dot product: sum_i a[i]*b[i] (real float/double, or int32/uint32 mod 2^32).
template<typename Wide, typename Narrow>
requires std::is_floating_point_v<Wide>
Wide mtl::simd::reduce_dot_widen (const Narrow *a, const Narrow *b, std::size_t n)
 Widening dot product: sum_i a[i]*b[i] with Narrow elements (e.g.
template<typename Wide, typename NA, typename NB = NA>
requires std::is_integral_v<Wide>
Wide mtl::simd::reduce_dot_widen (const NA *a, const NB *b, std::size_t n)
 Widening INTEGER dot product: 16-bit operands accumulated in 32 bits, via the hardware's widening multiply-accumulate (#451 phase 2).
template<typename NA, typename NB = NA>
float mtl::simd::reduce_dot_block_scaled (const NA *a, const NB *x, const float *scales, std::size_t n_blocks, std::size_t block)
 Block-scaled integer dot product (#628):
template<typename T>
T mtl::simd::reduce_sum_squares (const T *a, std::size_t n)
 sum of squares: sum_i a[i]*a[i] (two_norm computes sqrt of this).
template<typename T>
void mtl::simd::axpy (T alpha, const T *x, T *y, std::size_t n)
 axpy: y[i] += alpha*x[i].
template<typename T>
void mtl::simd::scal (T alpha, T *x, std::size_t n)
 scal: x[i] *= alpha.