FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::KahanAccumulator< DT_ > Class Template Reference

Kahan Summation accumulator class template. More...

#include <kahan_accumulator.hpp>

Public Member Functions

 KahanAccumulator ()
 default constructor More...
 
 KahanAccumulator (DT_ val)
 constructor More...
 
void clear ()
 clears the accumulator, i.e. sets all values to zero More...
 
 operator DT_ () const
 returns the value of the sum More...
 
KahanAccumulatoroperator+= (DT_ val)
 updates the summed accumulator with a new summand More...
 

Public Attributes

DT_ correction
 the current correction More...
 
DT_ value
 the current sum value More...
 

Detailed Description

template<typename DT_>
class FEAT::KahanAccumulator< DT_ >

Kahan Summation accumulator class template.

This class implements the Kahan summation algorithm for a given floating point data type, see e.g. https://en.wikipedia.org/wiki/Kahan_summation_algorithm

Author
Peter Zajac

Definition at line 19 of file kahan_accumulator.hpp.

Constructor & Destructor Documentation

◆ KahanAccumulator() [1/2]

template<typename DT_ >
FEAT::KahanAccumulator< DT_ >::KahanAccumulator ( )
inline

default constructor

Definition at line 28 of file kahan_accumulator.hpp.

◆ KahanAccumulator() [2/2]

template<typename DT_ >
FEAT::KahanAccumulator< DT_ >::KahanAccumulator ( DT_  val)
inlineexplicit

constructor

Definition at line 35 of file kahan_accumulator.hpp.

Member Function Documentation

◆ clear()

template<typename DT_ >
void FEAT::KahanAccumulator< DT_ >::clear ( )
inline

clears the accumulator, i.e. sets all values to zero

Definition at line 42 of file kahan_accumulator.hpp.

References FEAT::KahanAccumulator< DT_ >::correction, and FEAT::KahanAccumulator< DT_ >::value.

Referenced by FEAT::Statistics::reset_times().

◆ operator DT_()

template<typename DT_ >
FEAT::KahanAccumulator< DT_ >::operator DT_ ( ) const
inline

returns the value of the sum

Definition at line 58 of file kahan_accumulator.hpp.

◆ operator+=()

template<typename DT_ >
KahanAccumulator & FEAT::KahanAccumulator< DT_ >::operator+= ( DT_  val)
inline

updates the summed accumulator with a new summand

Definition at line 48 of file kahan_accumulator.hpp.

References FEAT::KahanAccumulator< DT_ >::correction, and FEAT::KahanAccumulator< DT_ >::value.

Member Data Documentation

◆ correction

template<typename DT_ >
DT_ FEAT::KahanAccumulator< DT_ >::correction

the current correction

Definition at line 25 of file kahan_accumulator.hpp.

Referenced by FEAT::KahanAccumulator< DT_ >::clear(), and FEAT::KahanAccumulator< DT_ >::operator+=().

◆ value


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