Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::KahanAccumulator< T > Struct Template Reference

Performs Kahan-Babuška-Neumaier compensated summation to prevent floating-point loss of precision. More...

#include <Precision.hpp>

Public Member Functions

constexpr void add (T val) noexcept
constexpr void reset () noexcept
constexpr T value () const noexcept
constexpr operator T () const noexcept

Public Attributes

T sum {0}
T compensation {0}

Detailed Description

template<typename T = real_t>
struct correlation::KahanAccumulator< T >

Performs Kahan-Babuška-Neumaier compensated summation to prevent floating-point loss of precision.

Template Parameters
TFloating point type (defaults to real_t).

Member Function Documentation

◆ add()

template<typename T = real_t>
void correlation::KahanAccumulator< T >::add ( T val)
inlineconstexprnoexcept
Here is the caller graph for this function:

◆ operator T()

template<typename T = real_t>
correlation::KahanAccumulator< T >::operator T ( ) const
inlineconstexprnoexcept

◆ reset()

template<typename T = real_t>
void correlation::KahanAccumulator< T >::reset ( )
inlineconstexprnoexcept

◆ value()

template<typename T = real_t>
T correlation::KahanAccumulator< T >::value ( ) const
inlinenodiscardconstexprnoexcept
Here is the caller graph for this function:

Member Data Documentation

◆ compensation

template<typename T = real_t>
T correlation::KahanAccumulator< T >::compensation {0}

◆ sum

template<typename T = real_t>
T correlation::KahanAccumulator< T >::sum {0}

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