MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::math::exact_accumulator< T > Struct Template Reference

Exact sum of products of Ts (top of file). More...

#include <exact_accumulator.hpp>

Public Types

using lim = std::numeric_limits<T>

Public Member Functions

bool negative () const

Public Attributes

std::array< std::uint64_t, limbs > w
std::uint8_t special

Static Public Attributes

static constexpr int lsb = 2 * (lim::min_exponent - lim::digits)
 Binary exponent of bit 0: the smallest product of two subnormals.
static constexpr int bits = 2 * lim::max_exponent - lsb + 64
 Bits for the largest product, 2^(2 * max_exponent), plus 64 carry bits.
static constexpr std::size_t limbs = static_cast<std::size_t>(bits + 63) / 64
static constexpr std::uint8_t pos_inf = 1
 Non-finite state, as bit flags: an infinity of each sign, and NaN.
static constexpr std::uint8_t neg_inf = 2
static constexpr std::uint8_t nan = 4

Detailed Description

template<typename T>
requires exact_accumulable<T>
struct mtl::math::exact_accumulator< T >

Exact sum of products of Ts (top of file).

Trivially constructible: a value-initialized exact_accumulator<T>{} is zero, and so is one cleared with accumulator_clear.

Member Typedef Documentation

◆ lim

template<typename T>
using mtl::math::exact_accumulator< T >::lim = std::numeric_limits<T>

Member Function Documentation

◆ negative()

template<typename T>
bool mtl::math::exact_accumulator< T >::negative ( ) const
inline

Member Data Documentation

◆ bits

template<typename T>
int mtl::math::exact_accumulator< T >::bits = 2 * lim::max_exponent - lsb + 64
staticconstexpr

Bits for the largest product, 2^(2 * max_exponent), plus 64 carry bits.

◆ limbs

template<typename T>
std::size_t mtl::math::exact_accumulator< T >::limbs = static_cast<std::size_t>(bits + 63) / 64
staticconstexpr

◆ lsb

template<typename T>
int mtl::math::exact_accumulator< T >::lsb = 2 * (lim::min_exponent - lim::digits)
staticconstexpr

Binary exponent of bit 0: the smallest product of two subnormals.

◆ nan

template<typename T>
std::uint8_t mtl::math::exact_accumulator< T >::nan = 4
static

◆ neg_inf

template<typename T>
std::uint8_t mtl::math::exact_accumulator< T >::neg_inf = 2
static

◆ pos_inf

template<typename T>
std::uint8_t mtl::math::exact_accumulator< T >::pos_inf = 1
staticconstexpr

Non-finite state, as bit flags: an infinity of each sign, and NaN.

◆ special

template<typename T>
std::uint8_t mtl::math::exact_accumulator< T >::special

◆ w

template<typename T>
std::array<std::uint64_t, limbs> mtl::math::exact_accumulator< T >::w

The documentation for this struct was generated from the following file: